cgm225 Posted February 18, 2008 Share Posted February 18, 2008 For my site I have been using a header.php and footer.php file to form a website "wrapper" in between which unique files are included. The header.php file includes the title and meta data, etc. So, for example, my main page would be generated by a file that includes three files: include_once "header.php"; include_once "frontpage.php" include_once "footer.php"; Or similarly, I could generate an e-mail page as such: include_once "header.php"; include_once "emailMe.php" include_once "footer.php"; However, here is my question. Is there a way, without using output buffering or templates (like Smarty), to set the webpage title (that found between the <title> tags within the header.php file) from the second included file/unique file found in between the header and footer? Right now I am doing this with output buffering, but I am trying to get away from that. Should I be creating my website "wrapper" a completely different way? Thank you all in advance! Quote Link to comment Share on other sites More sharing options...
AndyB Posted February 18, 2008 Share Posted February 18, 2008 I normally handle that case like this: <?php $title = "This is the page title"; include_once "header.php"; include_once "emailMe.php" include_once "footer.php"; And then modify the header.php file to include this line in the appropriate location: echo "<title>". $title. "</title>"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.