PDA

View Full Version : Defining a variable


paulyy
11-21-2004, 03:41 AM
How do I create a variable that will detect the page and show a certain image?

I'm not a PHP person at all, so please reply in dummy language :) I figured in theory it would be something like;

$pageimg =
IF page=gallery.php SHOW <img src="images/misc/gallery.gif" />
OR
IF page=cars.php SHOW <img src="images/misc/car.gif" />


I plan on adding this to my phpinclude_start. Any help is appreciated!

paulyy
11-21-2004, 05:14 AM
Just remembered xenon told me awhile back that declaring variables in the phpinclude_start won't actually work in "called templates". Does this mean it won't work in the header template? If not, how or where do I declare them so that they will?

Any help on this is appreciated!

Xenon
11-21-2004, 04:17 PM
if (THIS_SCRIPT == 'gallery') $showimage = '<img src="images/misc/gallery.gif" />';

this belongs to the phpinclude_start template

and it works in the header but there are templates which are called from within functions, and those can't use those vars (like postbit for example)

paulyy
11-22-2004, 05:27 AM
I see, thanks a lot! :)

paulyy
11-22-2004, 09:49 AM
Nevermind done this bit! :)

Xenon
11-24-2004, 05:03 PM
you're welcome :)