Jump to content

Archived

This topic is now archived and is closed to further replies.

koolaidman52

using somthing along the lines of str_replace for unique page titles

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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]
<?php
echo "
<!-- 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

Share this post


Link to post
Share on other sites
Not bad, thats incredibly simply and I should have been able to come up witht that, thanks for the speedy reply

Share this post


Link to post
Share on other sites
not a problem :)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.