pea_1 Posted April 22, 2007 Share Posted April 22, 2007 Hello, I want to use headers and footers for my website but i'm having trouble with the title tags. What i'm trying to do is put the page title into a variable on the contents page and then have the header echo it in the title tags. The structure's like this: contents page: <?php $title = "title"; include("header.php"); ?> content <?php include("footer.php"); ?> header.php: <html> <head> <title><?php echo $title; ?></title> </head> </html> But for some reason '$title' isn't echoing. Is there something i should be doing? Thanks, Peter Quote Link to comment Share on other sites More sharing options...
Trium918 Posted April 22, 2007 Share Posted April 22, 2007 Try placing this inside the header file <?php $title = 'title';?> <TITLE><?php=$title?></TITLE> Quote Link to comment Share on other sites More sharing options...
unkwntech Posted April 22, 2007 Share Posted April 22, 2007 That is odd, I don't see any errors... Is there anywhere that we can see this page in action. Quote Link to comment Share on other sites More sharing options...
pea_1 Posted April 22, 2007 Author Share Posted April 22, 2007 But that'd be exactly the same as: <title>title</title> --- I've just done a test and it's work ok, so i must be doing something stupid. Quote Link to comment Share on other sites More sharing options...
Trium918 Posted April 22, 2007 Share Posted April 22, 2007 But that'd be exactly the same as: <title>title</title> I have another way that I am using but it involves the use of functions Quote Link to comment Share on other sites More sharing options...
pea_1 Posted April 22, 2007 Author Share Posted April 22, 2007 I found the problem, for some reason it didn't like including the whole address (http://www.example.com/etc). Used ./ect/header.php instead and it works. No idea why though Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.