I have a site that has a main page and subpages for the articles comments.
What I want it is for the titles of the pages of the comments to be the same as the article's page title.
So I have this on the page file, the base for all the comments pages:
class Page {
private $title;
private $scripts;
private $css;
function __construct($title = 'Default Title')
{
$this->setTitle($title);
$this->scripts = array();
$this->css = array();
}
function setTitle($title)
{
$this->title = $title;
}
function getTitle()
{
return $this->title;
}
function header()
{
if(!isset($_SESSION)) session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $title; ?></title>
And I have this in the comments page:
class CommentsPage extends Page {
function __construct($title = '')
{
$this->setTitle($title);
}
function showAllComments($article_id, $param)
{
$article = Article::getById($article_id);
if(!empty($article))
{
?>
<div class="news_item">
<a href="/index.php?action=vote¶m=<?php echo $article->getId(); ?>"><img alt="vote button" class="vote_button" height="10" src="assets/images/vote2.png" width="10" class="border_less" /></a>
<h2 class="news_item_title"><b><a href = "<?php echo $article->getUrl(); ?>"><?php echo $article->getTitle(); ?></a></b></h2>
</div>
Where "$article->getTitle();" its what I want on the title.
Thx