autofocus Posted July 11, 2009 Share Posted July 11, 2009 Hi i was trying to use define($title, 'title of this page'); and then in title as follow <title><?=$title;?></title> i have separated header, content and footer and calling header and footer in each page. i have different content on each page. so i wanted title relevant to content. i did not get any error but script stopped after loading header. i think it is easy to achieve but i have no idea at this time. please help. thanks Link to comment https://forums.phpfreaks.com/topic/165586-how-to-have-a-different-page-title-for-each-page-of-site-using-php/ Share on other sites More sharing options...
BillyBoB Posted July 11, 2009 Share Posted July 11, 2009 You are trying to define a constant with the define function... You can find all info on every function at the php manual. http://us3.php.net/define If you want to define the term i suggest: define("TITLE", 'title of this page'); <title><?php=TITLE;?></title> I'm pretty sure that will work for you. Link to comment https://forums.phpfreaks.com/topic/165586-how-to-have-a-different-page-title-for-each-page-of-site-using-php/#findComment-873422 Share on other sites More sharing options...
autofocus Posted July 11, 2009 Author Share Posted July 11, 2009 thanks for the help. after posting i kept searching and found this link http://www.tutorialtastic.co.uk/tutorial/customising_your_page_title now i have page title according to content. thanks Link to comment https://forums.phpfreaks.com/topic/165586-how-to-have-a-different-page-title-for-each-page-of-site-using-php/#findComment-873457 Share on other sites More sharing options...
ignace Posted July 11, 2009 Share Posted July 11, 2009 This data probably also comes from a db? Then why not store the title in it also? <?php ... $result = mysql_query($query, $db); extract(mysql_fetch_assoc($result)); ?> <!DOCTYPE html> <html> <head> <title><?php print $title; ?></title> </head> <body> <div id="wrapper"> <div id="content"><?php print $content; ?></div> .. </body> </html> Link to comment https://forums.phpfreaks.com/topic/165586-how-to-have-a-different-page-title-for-each-page-of-site-using-php/#findComment-873469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.