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 Quote 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. Quote 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 Quote 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> Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.