You are here:  » customized title page on index.php only

Support Forum



customized title page on index.php only

Submitted by Oisin on Wed, 2006-12-06 16:09 in

hi david,

can i make a special title page for the index.php and not use the existing title and meta tags on /html/header.php?

thanks

Submitted by support on Wed, 2006-12-06 16:21

Hi Osin,

You can easily make a copy of html/header.php - and call it something like html/header_index.php. Make any changes you want to the new version, and then in index.php simply replace:

  require("html/header.php");

with:

  require("html/header_index.php");

Hope this helps,
Cheers,
David.

Submitted by Oisin on Thu, 2006-12-07 22:06

thanks, thats a simple method :)

would it be possible to just use the same header.php so that if i edited the header of the site i woulnd't have to edit two sites.

an IF statement is an idea.

something like if the page is index.php then show

thanks.

Submitted by support on Fri, 2006-12-08 00:12

Hi,

Yes - you can do that quite easily using PHP superglobal variable $_SERVER["PHP_SELF"]. For example, within html/header.php you could do this:

<?php
  
if ($_SERVER["PHP_SELF"] == "/index.php")
  {
    
// header code for index here
  
}
  else
  {
    
// header code for all other pages here
  
}
?>

Remember that you can break out of PHP in both those cases by closing the PHP tags - just remember to open them again before the closing }.

Cheers,
David.