General Community > Off-Topic

PHP help!!!!

(1/3) > >>

D. Peeters:
Hi,
On my website, I've a list of all products we sell (2000+). For each producer I would like to show their logo in a pop-up. Is there a way by which I can use one file (logo.php) for all logo's (like logo.php?id=Trimbach_Wines and logo.php?id=Trimbach_Wines)
Hope you guys can help me out :P
Thanks,
Duco

Waldschwein:
Hello,

hmm hmm... I know that problem very good here on that sites: http://www.deutschemaler.de/seiten/vorhandene-kuenstler/burghart-toni.php
It was quite a mess to create a site for each picture, get the thumbnail manually and create a link from the thumbnail to picture... But I had no real other choice, because they wanted it exactly like that (and well, google likes it, too).
In the end there has to be a module and a kind of pattern you can define.
But I haven't found anything that would help out here.

Yours Michael

D. Peeters:
Thanks anyway, but I think it's a bit too much for 2000+ producers :P

Anyone else ???? PLEASE !!!

pcwacht:
You need something like this?
http://www.henc.nl/pages/cpu-moederborden.php

There 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 image

This scripts uses a text file, but can be a mysql tabel as well


--- Code: ---<?php
$pad = WB_PATH.&#39;/media/somepath/&#39;;
$pad2 = WB_URL.&#39;/media/somepath/&#39;;
$artikelen = $pad.&#39;sometextfile.txt&#39;;
$handle = fopen ($artikelen, "r");
$vars = array(&#39;[NAAM]&#39;,&#39;[TEKST]&#39;,&#39;[PRIJS]&#39;);
$loopstart = &#39;<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>
&#39;;
$loop1 = &#39;<tr><td valign="top">[NAAM]</td><td valign="top">[TEKST]</td><td valign="top" align="right">[PRIJS]</td></tr>&#39;;
$loopend = &#39;</table><br />&#39;;

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.&#39;.jpg&#39;;
           $file12=$pad2.$art0.&#39;.jpg&#39;;
           $file4=$pad.$art0.&#39;-2.jpg&#39;;
           $file42=$pad2.$art0.&#39;-2.jpg&#39;;
           $file2=$pad.$art0.&#39;.txt&#39;;

           if (file_exists($file4)) {
               $size = getimagesize("$file4");
               $height = $size[1]+20;
               $width = $size[0]+20;
               $art0=&#39;<a href="javascript:popUp(&#39;.$width.&#39;,&#39;.$height.&#39;,&#39;;
               $art0.= "&#39;$file42&#39;";
               $art0.= &#39;)" ><img src="&#39;.$file12.&#39;" width=80 heigth=60 border=0 alt="&#39;.$art0.&#39;"></a>&#39;;
           } elseif (file_exists($file1)) {
               $size = getimagesize("$file1");
               $height = $size[1]+20;
               $width = $size[0]+20;
               $art0=&#39;<a href="javascript:popUp(&#39;.$width.&#39;,&#39;.$height.&#39;,&#39;;
               $art0.= "&#39;$file12&#39;";
               $art0.= &#39;)" ><img src="&#39;.$file12.&#39;" width=80 heigth=60 border=0 alt="&#39;.$art0.&#39;"></a>&#39;;
           }

            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" ) ;
}
?>

--- End code ---

Have fun,
John

D. Peeters:
I'm gonna try it tomorrow / Ga ik morgen uitproberen

Navigation

[0] Message Index

[#] Next page

Go to full version