Knowledgebase
Portal Home > Knowledgebase > PHP > Different title, keyword and description in every page's
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!
SolutionSet 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 inheader.php
. Here is an example:register.php:
<?php $title ="Registration"; $keywords ="Register, login"; $description ="Page for user registration"; include('https://solvitsolutions.co.ke/whmcs-bridge/?ccce=header');?>
header.php
<html><head> <meta name="keywords" content="<?;?>" /> <meta name="description" content="<?;?>" /> <title><?;?></title></head><body>
Powered by WHMCompleteSolution