[thelist] PHP: include not getting variable

Tom Dell'Aringa pixelmech at yahoo.com
Wed Jan 7 07:38:18 CST 2004


Hi,

Posted this before with no answer so trying to rephrase it. I had
used this technique before and it worked, now it doesn't. I have a
page template with a navigation include. Before the include I set a
variable to indicate what page I'm on. The navigation include is
supposed to read that variable, and then add a class to the
appropriate anchor. 

Here is the exact PHP code:

<?php $pagetag = "home"; ?>
<?php include("/includes/navigation.php");?>

So i set the name of the page i want... then...in the navigation
include:

<a href="/index.php" <?php if($pagetag == "home") { ?>
class="activePage" <?php } ?> ><span>Home</span></a>

Note that if $pagetag equals the same name as the link, it should
right out the class "activePage" which would make the tab blue not
white.

The problem is, the include doesn't recognize the variable $pagetag.
If I print it out it has no value at all. Why is this, and I how can
I get this to work?

You can see the pages at 

http://www.sparklesparties.com/

Look at the nav tabs, which are white. The current page tab should be
blue.

Tom



=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: JavaScript Author / Every Friday!
http://www.thywordistruth.net/ :: Eternal Life

[Those who say that I am finished, and am through, will have to run over my dead body to beat me...]


More information about the thelist mailing list