Welcome, Guest. Please login or register.
Did you miss your activation email?
February 12, 2012, 03:48:02 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
149621 Posts in 21098 Topics by 7537 Members
Latest Member: lotte2
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: PHP help!!!!  (Read 3569 times)
D. Peeters

Offline Offline

Posts: 128


« on: December 02, 2009, 06:27:36 PM »

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 Tongue
Thanks,
Duco
Logged
Waldschwein
Guest
« Reply #1 on: December 02, 2009, 06:33:10 PM »

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
Logged
D. Peeters

Offline Offline

Posts: 128


« Reply #2 on: December 02, 2009, 07:55:04 PM »

Thanks anyway, but I think it's a bit too much for 2000+ producers Tongue

Anyone else Huh? PLEASE !!!
Logged
pcwacht
Moderator
**
Offline Offline

Posts: 2814



WWW
« Reply #3 on: December 02, 2009, 10:05:44 PM »

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.'/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($handle4096);
         
$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" ) ;
}
?>


Have fun,
John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
D. Peeters

Offline Offline

Posts: 128


« Reply #4 on: December 02, 2009, 10:26:37 PM »

I'm gonna try it tomorrow / Ga ik morgen uitproberen
Logged
pcwacht
Moderator
**
Offline Offline

Posts: 2814



WWW
« Reply #5 on: December 02, 2009, 10:45:41 PM »

Tried droplets?

http://www.websitebakers.com/pages/droplets/official-library/images/image.php


Have fun,
John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
D. Peeters

Offline Offline

Posts: 128


« Reply #6 on: December 02, 2009, 10:47:18 PM »

Yeah, but they stopped working Sad now i'm seeing [[LastModified]] instead of 'laatste verandering: 30-11-2009 om 11:12'
Logged
D. Peeters

Offline Offline

Posts: 128


« Reply #7 on: December 03, 2009, 12:10:48 PM »

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:
code

Have fun,
John

what file did you use as 'sometextfile.txt'Huh 'cause mine didn't work  angry
Logged
pcwacht
Moderator
**
Offline Offline

Posts: 2814



WWW
« Reply #8 on: December 03, 2009, 03:21:52 PM »

a textfile with fixed length fields

You can see the 'parts'
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));
where
- art0 = article code, wich is allso the article picture
- art1 = description
- art2 = price
- art3 = productgroup, when 'mai' it is a motherboard (mainboard)


John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
D. Peeters

Offline Offline

Posts: 128


« Reply #9 on: December 03, 2009, 05:51:44 PM »

No, that's not what I meant (sorry  smiley ) What I meant:
I have a list of products we sell I want to be able to show our customers a logo (when they click on the name of a producer), but, since we have 2000+ products I don't want to create a seperate page for each logo, 'cause it will take too much time. Is there a way by which I can create a file, like 'logo.php' which redirects 'logo.php?id=6' to their logo (another way is also fine with me Tongue)

thanks,
duco
« Last Edit: November 03, 2010, 04:08:46 PM by D. Peeters » Logged
mr-fan

Offline Offline

Posts: 1538


WWW
« Reply #10 on: December 03, 2009, 06:19:30 PM »

hi,
is a kind of lightbox for the logo's a poissibility?

you want such logos like on this site http://www.wijnhandel-peeters.com/peeters/nederlands/assortiment/champagne.php

for all producers? right...you've these logos right?

so i think you must "link" this producers with the logos in every way.... rolleyes

so you can use a lightbox script set a link on every producer to the picture and ready - or use the .txt file from pcwacht to reorder the whole content together with pics

regards martin
Logged

 
pcwacht
Moderator
**
Offline Offline

Posts: 2814



WWW
« Reply #11 on: December 03, 2009, 08:14:30 PM »

hmmm,
I am thinking of a droplet wich creates the link (javascript like the code for henc.nl)

Something like:
scan for producer name -> change producer name wicth appropriete javascript code
so in a droplet:

Code:
// Need some wb variables, make them available
global $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;

Mind you, I didn't tested the code so don't know if I made a typo somewhere, but I am sure it will give you enough to get you started.

Allso the useage of droplets to manipulate the page output is once again good demonstrated.

Have fun,
John
« Last Edit: December 03, 2009, 08:18:03 PM by pcwacht » Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
D. Peeters

Offline Offline

Posts: 128


« Reply #12 on: December 03, 2009, 08:16:47 PM »

Thanks!
Logged
pcwacht
Moderator
**
Offline Offline

Posts: 2814



WWW
« Reply #13 on: December 03, 2009, 08:21:45 PM »

And here the javascript wich I used:

Code:
<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>

Put this somewhere in your header Wink

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!