WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • General Community »
  • Off-Topic »
  • PHP help!!!!
  • Print
Pages: [1]   Go Down

Author Topic: PHP help!!!!  (Read 13594 times)

Offline D. Peeters

  • Posts: 128
PHP help!!!!
« 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 :P
Thanks,
Duco
Logged

Waldschwein

  • Guest
Re: PHP help!!!!
« 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

Offline D. Peeters

  • Posts: 128
Re: PHP help!!!!
« Reply #2 on: December 02, 2009, 07:55:04 PM »
Thanks anyway, but I think it's a bit too much for 2000+ producers :P

Anyone else ???? PLEASE !!!
Logged

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: PHP help!!!!
« 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: [Select]
<?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" ) ;
}
?>


Have fun,
John
Logged
http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....

Offline D. Peeters

  • Posts: 128
Re: PHP help!!!!
« Reply #4 on: December 02, 2009, 10:26:37 PM »
I'm gonna try it tomorrow / Ga ik morgen uitproberen
Logged

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: PHP help!!!!
« 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.....

Offline D. Peeters

  • Posts: 128
Re: PHP help!!!!
« Reply #6 on: December 02, 2009, 10:47:18 PM »
Yeah, but they stopped working :( now i'm seeing [[LastModified]] instead of 'laatste verandering: 30-11-2009 om 11:12'
Logged

Offline D. Peeters

  • Posts: 128
Re: PHP help!!!!
« Reply #7 on: December 03, 2009, 12:10:48 PM »
Quote from: pcwacht 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: [Select]
code
Have fun,
John

what file did you use as 'sometextfile.txt'??? 'cause mine didn't work  :x
Logged

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: PHP help!!!!
« Reply #8 on: December 03, 2009, 03:21:52 PM »
a textfile with fixed length fields

You can see the 'parts'
Code: [Select]
         $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.....

Offline D. Peeters

  • Posts: 128
Re: PHP help!!!!
« Reply #9 on: December 03, 2009, 05:51:44 PM »
No, that's not what I meant (sorry  :-) ) 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 :P)

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

mr-fan

  • Guest
Re: PHP help!!!!
« 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.... :roll:

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

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: PHP help!!!!
« 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: [Select]
// 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.....

Offline D. Peeters

  • Posts: 128
Re: PHP help!!!!
« Reply #12 on: December 03, 2009, 08:16:47 PM »
Thanks!
Logged

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: PHP help!!!!
« Reply #13 on: December 03, 2009, 08:21:45 PM »
And here the javascript wich I used:

Code: [Select]
<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 ;)

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

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • General Community »
  • Off-Topic »
  • PHP help!!!!
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2