Здравствуйте.
Как можно вывести список материалов ниже названия подкатегории с количеством в ней материалов на макете со списком материалов категории (/components/com_content/views/category/tmpl/default_children.php).
На финише должна получится такая консутркция:
- Название категории
-- Таблица со списком материалов
-Название подкатегории
-- Материал подкатегории 1
-- Материал подкатегории 2
-- Материал подкатегории 3
-- Материал подкатегории 4
Сейчас вот такой код выводит ниже подкатегории список материалов основной категории т.е. дубль, а нужно соотвественно чтобы список материалов был подкатегории.
<?php
defined('_JEXEC') or die;
JHtml::_('bootstrap.tooltip');
$class = ' class="first"';
$lang = JFactory::getLanguage();
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Create some shortcuts.
$params = &$this->item->params;
$n = count($this->items);
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
// Check for at least one editable article
$isEditable = false;
if (!empty($this->items))
{
foreach ($this->items as $article)
{
if ($article->params->get('access-edit'))
{
$isEditable = true;
break;
}
}
}
$tableClass = $this->params->get('show_headings')!= 1 ? ' table-noheader' : '';
?>
<?php if (count($this->children[$this->category->id]) > 0) : ?>
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
<?php
if ($this->params->get('show_empty_categories') || $child->getNumItems(true) || count($child->getChildren())) :
if (!isset($this->children[$this->category->id][$id + 1])) :
$class = ' class="last"';
endif;
?>
<div <?php echo $class; ?>>
<?php $class = ''; ?>
<?php if ($lang->isRtl()) : ?>
<?php else : ?>
<?php foreach ($this->items as $i => $article) : ?>
<?php if ($this->items[$i]->state == 0) : ?>
<?php else : ?>
<?php endif; ?>
<?php if (in_array($article->access, $this->user->getAuthorisedViewLevels())) : ?>
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language)); ?>"><?php echo $this->escape($article->title); ?></a>
<?php if (JLanguageAssociations::isEnabled() && $this->params->get('show_associations')) : ?>
<?php $associations = ContentHelperAssociation::displayAssociations($article->id); ?>
<?php foreach ($associations as $association) : ?>
<?php if ($this->params->get('flags', 1)) : ?>
<?php $flag = JHtml::_('image', 'mod_languages/' . $association['language']->image . '.gif', $association['language']->title_native, array('title' => $association['language']->title_native), true); ?>
<a href="<?php echo JRoute::_($association['item']); ?>"><?php echo $flag; ?></a>
<?php else : ?>
<?php $class = 'label label-association label-' . $association['language']->sef; ?>
<a class="' . <?php echo $class; ?> . '" href="<?php echo JRoute::_($association['item']); ?>"><?php echo strtoupper($association['language']->sef); ?></a>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php else : ?>
<?php
echo $this->escape($article->title). ' : ';
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));
$link->setVar('return', base64_encode(ContentHelperRoute::getArticleRoute($article->slug, $article->catid, $article->language)));
?>
<a href="<?php echo $link; ?>" class="register">
<?php echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE'); ?>
</a>
<?php if (JLanguageAssociations::isEnabled() && $this->params->get('show_associations')) : ?>
<?php $associations = ContentHelperAssociation::displayAssociations($article->id); ?>
<?php foreach ($associations as $association) : ?>
<?php if ($this->params->get('flags', 1)) : ?>
<?php $flag = JHtml::_('image', 'mod_languages/' . $association['language']->image . '.gif', $association['language']->title_native, array('title' => $association['language']->title_native), true); ?>
<a href="<?php echo JRoute::_($association['item']); ?>"><?php echo $flag; ?></a>
<?php else : ?>
<?php $class = 'label label-association label-' . $association['language']->sef; ?>
<a class="' . <?php echo $class; ?> . '" href="<?php echo JRoute::_($association['item']); ?>"><?php echo strtoupper($association['language']->sef); ?></a>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php if (count($child->getChildren()) > 0 && $this->maxLevel > 1) : ?>
<div class="collapse fade" id="category-<?php echo $child->id; ?>">
<?php
$this->children[$child->id] = $child->getChildren();
$this->category = $child;
$this->maxLevel--;
echo $this->loadTemplate('children');
$this->category = $child->getParent();
$this->maxLevel++;
?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>