Forums
This topic is locked
PHP page title with template
Posted 05 Oct 2008 19:19:42
1
has voted
05 Oct 2008 19:19:42 Garret Petersen posted:
I use the following php code to link my pages but also need to change the title, is it possible to change the title using the link itself?<?php
$page = strip_tags($_GET['page']);// GETS VALUE FOR $page
if (!$page)// SEES IF $page IS DEFINED//IF IT ISN'T IT WILL DISPLAY home.php
{
$include = 'home.php';
include ($include);
}
else
{
$include = $page .'.php';// $include ADDS THE DIRECTORY AND PAGE EXTENSION OF page
if (is_file("$include")// CHECKS IF $include EXISTS
{
include ($include);// SHOWS THE CONTENT OF $include
}
else// DISPLAY ERROR MESSAGE IF $include IS NOT FOUND
{
echo "The page you were trying to access is not found on this server.";
}
}
?>
example page: www.mysite.com/index.php?page=shipping
Title would then be Mysite, shipping