Different Titles <head>

Different Titles <head>

Posted by: steve.spam
Posted on: 2008-09-02 07:42:00

Hi there!

My website consists in 3 parts, 2 "statics" one: header.php and footer.php and another one "dynamic", let's call it content.php

What happens is, whenever a "dynamic" page, ie: products, about us, contatc, etc... is loaded, the server loads automatically the header.php and footer.php

This actually saves me some time, because when I need to change like an information on the footer, I don't have to edit too many files, just one (the footer.php).

But I'm facing a small "problem" here, since I have only one header (that contains our TITLE), all my pages have the same title... what is not recommended for Search Engines optimizations... so, here comes the question:

How can I have separate/different page titles if I have only 1 "static" header page...

Thanks in advance,

Steve.

Re: Different Titles <head>

Posted by: sXi
Posted on: 2008-09-02 08:47:00

Remove the TITLE element from header.php and have different ones in contact.php, about.php, etc.


Re: Different Titles <head>

Posted by: steve.spam
Posted on: 2008-09-02 09:09:00

Thanks sXi !

It looks so obvious now...
I've tried this before... but at the first attempt, i forgot to include <head> </head> on the "dynamic" pages...

Thanks for your help.

Re: Different Titles <head>

Posted by: sXi
Posted on: 2008-09-02 09:11:00

No worries. Your site looks fantastic.


Re: Different Titles <head>

Posted by: silkrooster
Posted on: 2008-09-02 16:52:00

Stop and think about it. Your page is a php page. Why not add a variable to your title tag?

?> //php code before this line (optional)
<title><?php print $pagetitle; ?> - additional text</title>
<?php //php code after this line (optional)

Now your dynamic page can assign a value to $pagetitle. It may be best to assign the variable first them include your header. It's been awhile since i did any coding so I can't recall if the whole page gets parsed before displaying or as it runs through the code. Sorry about that.
Silk

My website