Question

The list would serve as a sidebar menu next to the article. How should I do this?! From the article template, the only thing I managed to retrieve was the current articles category title, but I don't know how to get the category object itself:

$this->item->category_title

Is it possible to achieve this by changing or overriding the default article code?

Was it helpful?

Solution

Short answer - no. The template is for defining the layout of main content areas and module positions.

Extra functionality should be defined through Joomla! extensions, for the particular functionality you're looking for you will need a module from the Article Listing section.

You haven't specified a version of Joomla! but we have previously used ArtCats on Joomla! 1.5.

OTHER TIPS

If I understand you correctly it is possible. However, a module as cppl points out would probably be more nice. This requires a database query and is not really template/layout related. Anyway, this could probably do the trick:

In templates/your_template/html/com_content/article/default.php :

<?php
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('a.id, a.title');
$query->from('#__content AS a');
$query->where('a.catid = '.(int)$this->item->catid);
$query->where('a.state = 1');
$query->where('a.id != '.(int)$this->item->id);
$db->setQuery($query);
$articles = $db->loadObjectList();
?>
<ul>
    <?php foreach($articles as $item) : ?>
    <ul>
        <li><?php echo $item->title; ?></li>
    </ul>
    <?php endforeach; ?>
</ul>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top