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 Link to comment https://forums.phpfreaks.com/topic/48178-php-templating/ 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> Link to comment https://forums.phpfreaks.com/topic/48178-php-templating/#findComment-235513 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. Link to comment https://forums.phpfreaks.com/topic/48178-php-templating/#findComment-235516 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. Link to comment https://forums.phpfreaks.com/topic/48178-php-templating/#findComment-235517 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 Link to comment https://forums.phpfreaks.com/topic/48178-php-templating/#findComment-235523 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 Link to comment https://forums.phpfreaks.com/topic/48178-php-templating/#findComment-235528 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.