WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
<?php$pad = WB_PATH.'/media/somepath/';$pad2 = WB_URL.'/media/somepath/';$artikelen = $pad.'sometextfile.txt';$handle = fopen ($artikelen, "r");$vars = array('[NAAM]','[TEKST]','[PRIJS]');$loopstart = '<table cellspacing="0" cellpadding="1" width="100%" border="1"> <tr><th><b>Artikel</b></th><th><b>Omschrijving</b></th><th><b>Stuksprijs</b></th></tr>';$loop1 = '<tr><td valign="top">[NAAM]</td><td valign="top">[TEKST]</td><td valign="top" align="right">[PRIJS]</td></tr>';$loopend = '</table><br />';if ( $handle ) { echo "Moederborden<br />"; echo $loopstart; while (!feof ($handle)) { $buffer = fgets($handle, 4096); $art0=trim(substr($buffer,0,12)); $art1=trim(substr($buffer,12,33)); $art2=trim(substr($buffer,46,8)); $art3=trim(substr($buffer,64,3)); switch ($art3) { case "MAI": $file1=$pad.$art0.'.jpg'; $file12=$pad2.$art0.'.jpg'; $file4=$pad.$art0.'-2.jpg'; $file42=$pad2.$art0.'-2.jpg'; $file2=$pad.$art0.'.txt'; if (file_exists($file4)) { $size = getimagesize("$file4"); $height = $size[1]+20; $width = $size[0]+20; $art0='<a href="javascript:popUp('.$width.','.$height.','; $art0.= "'$file42'"; $art0.= ')" ><img src="'.$file12.'" width=80 heigth=60 border=0 alt="'.$art0.'"></a>'; } elseif (file_exists($file1)) { $size = getimagesize("$file1"); $height = $size[1]+20; $width = $size[0]+20; $art0='<a href="javascript:popUp('.$width.','.$height.','; $art0.= "'$file12'"; $art0.= ')" ><img src="'.$file12.'" width=80 heigth=60 border=0 alt="'.$art0.'"></a>'; } if (file_exists($file2)) { $art1=file_get_contents ($file2); } $values=array($art0,$art1,$art2); echo str_replace($vars,$values,$loop1); break; default: break; } } echo $loopend; fclose($handle);} else { die( "Bestand : $filename niet gevonden" ) ;}?>
You need something like this?http://www.henc.nl/pages/cpu-moederborden.phpThere is a litle php script runnin gin a code section, it fetches a text file and shows (in this case) only motherboards. IN the textfile is the name of the article wich is used for the small image, you can click on the small image and a popup comes with a larger image, if it exists, or a larger image of the same imageThis scripts uses a text file, but can be a mysql tabel as wellCode: [Select]codeHave fun,John
code
$art0=trim(substr($buffer,0,12)); $art1=trim(substr($buffer,12,33)); $art2=trim(substr($buffer,46,8)); $art3=trim(substr($buffer,64,3));
// Need some wb variables, make them availableglobal $wb; // $wb_page_data holds the output of the current page// Search for producername and replace it$producer_name[1] = 'name_of_producer1';$producer_picture[1] = 'picture_of_producer1.jpg';$producer_name[2] = 'name_of_producer2';$producer_picture[2] = 'picture_of_producer2.jpg';// Here the code starts:$arr_size=count($producer_name); for($i=1;$i<$arr_size;$i++) { $js_picture ='<a href="javascript:popUp('.$width.','.$height.','; $js_picture .= WB_URL."/media/producers/'$producer_picture[$i]'"; $js_picture .= ')" ><img src="'.WB_URL."/media/producers/'$producer_picture[$i]'".'" width=80 heigth=60 border=0 alt="'.$producer_name[$i].'"></a>'; $wb_page_data = str_replace("producer_name[$i]", $js_picture, $wb_page_data);}// Since the output was directly altered we don't have something to return// But we must return at least TRUE!return TRUE;
<script language="JavaScript"><!--function popUp(w,h,site) { x = screen.availWidth/2-w/2; y = screen.availHeight/2-h/2; newWin=void(window.open(site,'','resizable=1,width='+w+',height='+h+',top='+y+',left='+x));}//--></script>