[thelist] PHP: include not getting variable

Tom Dell'Aringa pixelmech at yahoo.com
Wed Jan 7 08:01:13 CST 2004


--- Jay Blanchard <jay.blanchard at niicommunications.com> wrote:
> [snip]
> <?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>
> 
> 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?
> [/snip]
> 
> Try this ... (I mangled lines to see better)
> <a href="/index.php" 
> <?php 
> if($pagetag == "home"){ 
> 	echo "class=\"activePage\">"; 
> } else {
> 	echo ">";
> }
> ?>

Same result, doesn't work. The problem is the value of $pagetag is
nothing at all. Printing out results in a blank.... why this is I
don't understand.

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