Jump to content

To set up page title depending on content


Kiubbo

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.