Jump to content

Recommended Posts

Hello,

I am assigned a task to make alterations on a client website.

The header is an include on all pages.

Inside the header is the title tag which propogate to all pages. I want title different to each page, I will also add description and keyword. Is there a way to do this with PHP or should I have different header for each page.

 

thank you

Link to comment
https://forums.phpfreaks.com/topic/225129-how-can-i-add-different-title/
Share on other sites

Sure, there are multiple ways of doing this depending on your structure.  You can look at the page (URI), send a command for whatever page you're directing to etc.  Again, it depends on your structure, specifically how you navigate through each section.

Thank you for your replies.

Maq,

the site is small and navigation is a list in the header.

 

Jocka,

the header page is header.php

 

I am to understand in header.php I add <title><? echo $title; ?></title> and on each page I add $title = "SITENAME - Pagename"; where pagename is the page being accessed. I add this before the include.

 

Would it be correct to add description and keywords the same way??

 

Thank you for this help.

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.