Re: Using variables from includes

From: Date: Wed, 25 Jun 2003 19:08:11 +0000
Subject: Re: Using variables from includes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-152861@lists.php.net to get a copy of this message
> > include ("http://www.site.com/home.php"); > > } > > else{ > > include ("http://www.site.com/" . > > "$page" . ".php"); > > } > > ?> > > This code is in the index.php file. When home.php is included, I > > want to echo a variable like $title on the index.php page. But > > $title is defined on home.php. For some reason, I can't get $title > >to echo on index.php after it's included. Anyone know?? Yeah, it's because you're including the output of those files (the HTML or whatever) rather than the files themselves. Just include them using their filesystem path: include ('path/to/home.php'); Chris ===== Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/

« previous php.general (#152861) next »