Jump to content

[SOLVED] Making <title> different for each page, when it is being included


Recommended Posts

I have a include file called header, that takes the logo and navigation so that i dont need to duplicate code.

 

Problem is, <title> comes with this and I want this to be different for each page.  I.e. "page a - website name", "page b - website name"

 

Any ideas?

Another way would be to set the title in the calling script. i.e. $title = "this is a great website", before the include.  Then replace the <title> tags in the header like wmguk has shown :

<title><?php echo $title; ?></title>

Thanks guys.

 

One additional problem I have realised as well:

 

The navigation is in the header and it differs based on what page you are on; i.e. one of the buttons has a property called "selected".

 

Perhaps if I made all the code in header a function and passed a page name as a param?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.