I'm trying to build a module that should show the article title of the current article viewed.
I've started from this code in my default.php layout that shows the title of the page, but I need to edit it so that it shows the article title and not the page title.
$heading = $document->getTitle();
How should I edit it to get the article title instead of the page title?
I've solved this way:
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
if ($option=="com_content" && $view=="article") {
$ids = explode(':',JRequest::getString('id'));
$article_id = $ids[0];
$article =& JTable::getInstance("content");
$article->load($article_id);
$heading = $article->get("title");
}
Not sure it's the correct/best solution, but it seems work at the moment. Any suggestion, comment about this code or better implementation?