disappearing php variables?

From: Date: Tue, 20 May 2003 07:26:45 +0000
Subject: disappearing php variables?
Groups: php.general 
Request: Send a blank email to php-general+get-148248@lists.php.net to get a copy of this message
I have a problem with php variables that are set outside an include, being empty when called inside the include. in http://ponder.megalion.org/index_photoskin.html I have the following code (snipped for length) $mtBlogURL = "http://ponder.megalion.org/"; $rootPath = "/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs"; if ($skin=="") { $skin = "venturaSunset"; } if ($page=="index") { $skinPath = "/mt/skins/"; } else if ( $page=="archive") { $skinPath = "/mt/skins/"; } else if ( $page=="category") { $skinPath = "/mt/skins/"; } else if ( $page=="date") { $skinPath = "/mt/skins/"; } else if ( $page=="individual") { $skinPath = "/mt/skins/"; } else { $skinPath = "/mt/skins/"; } include $rootPath."/mt/tmpl/php_functions.php"; include $mtBlogURL.$skinPath.$skin."/header.php"; in /mt/skins/venturaSunset/header.php, I have the following code: echo "rootPath is ".$rootPath."<br>"; echo "page is ".$page."<br>"; echo "pageTitle is ".$pageTitle."<br>"; ?> <html> <head> <title><?=$blogTitle?><?if ($pageTitle!="") { ?> - <?=$pageTitle?><?}?></title> <link rel="stylesheet" type="text/css" href="<?=$mtBlogURL?><?=$skinPath?><?=$skin?>/theme.css"> <SCRIPT src="<?=$skinPath?>rollover.js" TYPE="text/javascript"></SCRIPT> </head> <body> <?=getcwd();?> The output at the top of the page in the browser is as follows: rootPath is page is pageTitle is /usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs/mt/skins/venturaSunset source code: rootPath is <br>page is <br>pageTitle is <br><html> <head> <title></title> <link rel="stylesheet" type="text/css" href="/theme.css"> <SCRIPT src="rollover.js" TYPE="text/javascript"></SCRIPT> </head> I've been going over this for over 2 hours and I can't find any reason why the header.php thinks all my variables are empty. I even did a test where I created http://ponder.megalion.org/test.php that had <? $test = "This is a test"; include "include.php"; ?> and created also http://ponder.megalion.org/include.php that simply has <?=$test?> and it works. The include.php file is able to see php variables set in the calling file. So why is header.php unable to see variables set in index_photoskin.html? Btw I have php processing enabled for html files via the apache config file but I don't see that making a difference as I copied test.php as test.html and http://ponder.megalion.org/test.html works just as well as the other. I'm racking my brain as to what's going on... as some of you may recognize... this is my installation of the Movable Type blog software and I'm attempting to make it skinnable. Thanks Megalion

« previous php.general (#148248) next »