SolvIT Solutions
Please Login or Register

Knowledgebase

Different title, keyword and description in every page's

How can I add a different title, keyword and description in every page's <head> of my simple php website dynamically?

I have included file header.php in all of my pages, how can i know in what page the user in?

For example, I have php files register.php, and login.php, and I need different titles, keywords and descriptions.

I do not want use the $_GET method.

Thanks!

Solution

Set variables at the top of each page that will be read by header.php. Then insert the values of the variables in the right places in header.php. Here is an example:

register.php:

<?php
    $title ="Registration";
    $keywords ="Register, login";
    $description ="Page for user registration";

    include('header.php');?>

header.php

<html><head>
        <meta name="keywords" content="<?php echo $keywords;?>" />
        <meta name="description" content="<?php echo $description;?>" />
        <title><?php echo $title;?></title></head><body>


Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article


Powered by WHMCompleteSolution

Language:

Quick Navigation

Client Login

Email

Password

Remember Me

Search



Follow Us on Twitter