Page 1 of 1

if statement on page title

Posted: Thu Aug 06, 2009 10:54 pm
by REwingUK
I'm trying to add an if statement to the title of my webpage.

I basically want to say if the page is on detail.php then show this title, else show the normal title. Any ideas?

Code: Select all

if $pageurl = detail.php {
 
<title><? echo $tt_45['Address']." "; ?></title>
 
}
else 
{
<title>Normal Title</title>
}
 
Thanks in advance

Re: if statement on page title

Posted: Thu Aug 06, 2009 10:56 pm
by s.dot

Code: Select all

<?php
$title = !empty($_SERVER['PHP_SELF']) && (basename($_SERVER['PHP_SELF']) == 'detail.php') ? 'detail page title' : 'normal title';
 
echo '<title>' . $title . '</title>';
?>