What i usually do, is make a file layout.php with a couple of functions, header() footer() etc.
then i include ('layout.php') and call the functions when i need them and i can send things to the header, like the page title etc. include ('layout.php'); header("Home"); blablablab footer(); i hope this is about what you mean Jule On Thursday, Oct 10, 2002, at 23:00 US/Eastern, Leif K-Brooks wrote: > I've been using php for a while now, and I've made plenty of web sites > in that time. But there's been a nagging problem: the best way to put > a > > layout and global code on each page. My first site had two .txt files > with header and footer code which were fopen()ed (with absolute > paths!) and eval()ed on each page at the top and bottom - not the best > option! Even if I include()d them and made them .php, that approach > would still > > have some problems. No way to get the global code without the layout, > and no way to die() and use the layout in functions without knowing > what > > variables it needs (for globalizing them). Right now, I'm doing > something like this: > > <?php > include("include.php"); //This contains the database connection code > and whatever other global code, as well as the layout functions. > doheader(); //This function contains the top of the layout. > //Do whatever the page does > dofooter(); //This function contains the bottom of the layout > ?> > > There are still problems with this, though. No way to use global code > at the bottom of the page, for one thing. I've also considered > something like: > > <?php > $uselayout = true; //Set whether this page wants the layout or not. > include("include.php"); > headercode(); //Database connection and whatever other global code > that goes at the top, as well as the layout if $uselayout is true. > //Whatever this page does goes here. > footercode(); //Whatever global code that goes at the bottom goes > here, as well as the layout if $uselayout is true. > ?> > > I can't find any problems with this approach, what are everyone;'s > thoughts on this? > > -- > The above message is encrypted with double rot13 encoding. Any > unauthorized attempt to decrypt it will be prosecuted to the full > extent > of the law. > > Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php