koolaidman52 Posted July 15, 2006 Share Posted July 15, 2006 on my site i include header.php, this page includes everything down to the unique content area for each page ("<div class="body">" is the last thing on the page.) unfortunately that means that the header is the same for every page and the title is the same as well.so my question is, can i use str_replace() in each page that I include the header page in and change the title for each page as well? If yes, then how?I hope that's clear enought to comprehend. Quote Link to comment https://forums.phpfreaks.com/topic/14685-using-somthing-along-the-lines-of-str_replace-for-unique-page-titles/ Share on other sites More sharing options...
Koobi Posted July 15, 2006 Share Posted July 15, 2006 how about this instead:contact.php[code=php:0]<?php$title = 'My contact page';include header.php;echo '<p>Contact me</p>';include footer.php;?>[/code]header.php:[code=php:0]<?phpecho "<!-- Doctype and other necessary tags come here --><title>$title</title></html><body>";?>[/code]this is just an example. the system can be optimized but that should fix the str_replace() problem for you Quote Link to comment https://forums.phpfreaks.com/topic/14685-using-somthing-along-the-lines-of-str_replace-for-unique-page-titles/#findComment-58568 Share on other sites More sharing options...
koolaidman52 Posted July 15, 2006 Author Share Posted July 15, 2006 Not bad, thats incredibly simply and I should have been able to come up witht that, thanks for the speedy reply Quote Link to comment https://forums.phpfreaks.com/topic/14685-using-somthing-along-the-lines-of-str_replace-for-unique-page-titles/#findComment-58569 Share on other sites More sharing options...
Koobi Posted July 15, 2006 Share Posted July 15, 2006 not a problem :) Quote Link to comment https://forums.phpfreaks.com/topic/14685-using-somthing-along-the-lines-of-str_replace-for-unique-page-titles/#findComment-58590 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.