ryanwood4 Posted August 4, 2009 Share Posted August 4, 2009 Hi, how do I get my pages to display a dynamic page title? I want the title at the top to say The F1 Times | <then here the title of the article> but because all the articles pass through the 'index.php' page I am having difficulty. I have tried a few options, all of which have failed. The database is called: 'f1times_articles' and the table: 'n2s_article', the title I want displayed comes under the column 'article_title' this has flummoxed me. Sorry if this doesn't make much sense - had difficulty explaining it. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/168860-dynamic-page-titles/ Share on other sites More sharing options...
jonsjava Posted August 4, 2009 Share Posted August 4, 2009 <?php $title = $article_title_grabbed_from_somewhere; ?> <html> <head> <title>The F1 Times | <?php echo $title;?></title> .... Link to comment https://forums.phpfreaks.com/topic/168860-dynamic-page-titles/#findComment-890944 Share on other sites More sharing options...
ryanwood4 Posted August 4, 2009 Author Share Posted August 4, 2009 Ok, but where do I add the connection to the database? Thanks. Link to comment https://forums.phpfreaks.com/topic/168860-dynamic-page-titles/#findComment-890950 Share on other sites More sharing options...
_DarkLink_ Posted August 4, 2009 Share Posted August 4, 2009 Well, depending on the logic of things, you should put the connection before the code, since you have to be connected to the database before fetching data from it. Link to comment https://forums.phpfreaks.com/topic/168860-dynamic-page-titles/#findComment-890967 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.