Jump to content


Photo

using somthing along the lines of str_replace for unique page titles


  • Please log in to reply
3 replies to this topic

#1 koolaidman52

koolaidman52
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 15 July 2006 - 05:05 PM

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.
Btcartoons.com --  coded entirely in Mom's basement.

#2 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 15 July 2006 - 05:13 PM

how about this instead:


contact.php
<?php
$title = 'My contact page';
include header.php;
echo '<p>Contact me</p>';
include footer.php;
?>


header.php:
<?php
echo "
<!-- Doctype and other necessary tags come here -->
<title>$title</title>
</html>
<body>
";
?>




this is just an example. the system can be optimized but that should fix the str_replace() problem for you

#3 koolaidman52

koolaidman52
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 15 July 2006 - 05:15 PM

Not bad, thats incredibly simply and I should have been able to come up witht that, thanks for the speedy reply
Btcartoons.com --  coded entirely in Mom's basement.

#4 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 15 July 2006 - 05:47 PM

not a problem :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users