[thelist] PHP: include not getting variable

Jay Blanchard jay.blanchard at niicommunications.com
Wed Jan 7 07:47:58 CST 2004

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

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

<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?

Try this ... (I mangled lines to see better)
<a href="/index.php" 
if($pagetag == "home"){ 
	echo "class=\"activePage\">"; 
} else {
	echo ">";

More information about the thelist mailing list