Kiubbo Posted March 10, 2009 Share Posted March 10, 2009 I am building in php a digg like site, I want the page title to be the same as the article title, here is the relevant code: <?php class CommentsPage extends Page { function showAllComments($article_id, $param) { $article = Article::getById($article_id); if(!empty($article)) { ?> <h2 class="news_item_title"><b><a href = "<?php echo $article->getUrl(); ?>"><?php echo $article->getTitle(); ?></a></b></h2> $this->showSubmitForm($article); } I want the page title to be the same as "$article->getTitle();" If someone knows the answer I will appreciate it. Thx Link to comment https://forums.phpfreaks.com/topic/148701-to-set-up-page-title-depending-on-content/ Share on other sites More sharing options...
redarrow Posted March 10, 2009 Share Posted March 10, 2009 use a session i think, don't no or use a global for the variable with the title name. Link to comment https://forums.phpfreaks.com/topic/148701-to-set-up-page-title-depending-on-content/#findComment-780816 Share on other sites More sharing options...
Kiubbo Posted March 10, 2009 Author Share Posted March 10, 2009 Thanks for the answer. Im still lost I guess I will go back to read the PHP manual from the start. Someone else half coded the site for me and I just want the page titles to be the same as the content article for SEO purposes. I know how to do it in the frontpage because its static but not how to get it together with php dynamic content. Regards, Carlos Link to comment https://forums.phpfreaks.com/topic/148701-to-set-up-page-title-depending-on-content/#findComment-781429 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.