1
   

Dynamic page titles

 
 
Reply Tue 1 Mar, 2005 10:48 am
I have a website using php header and footer includes (all hardcoded, no database), and I'm wondering if there's a way to give each individual content page a unique title tag. Can you define the title tag within the body element somehow?
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 633 • Replies: 2
No top replies

 
AdamStone
 
  1  
Reply Tue 1 Mar, 2005 11:16 am
Found a solution using php. Here it is if anyone is interested:

If a given content page looks like this:
Code:<?php include 'header.php';?>

content... content... content...

<?php include 'footer.php';?>


you would put this in header.php:
Code:<title><?=$title?></title>


and make this change to each content page:
Code:<?php $title='Page Title'; include 'header.php';?>
0 Replies
 
Craven de Kere
 
  1  
Reply Wed 2 Mar, 2005 01:58 pm
Code:<?php

//set initial variables

$title = "Page Title";

include 'header.php';

?>

content... content... content...

<?php include 'footer.php';?>



Just declare the variable before it's called.
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » Dynamic page titles
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 01/18/2025 at 12:16:01