在博客布局的标题下显示子类别文章

时间:2015-11-05 20:55:32

标签: php joomla joomla3.0

我们正在为Joomla网站设置自定义博客布局覆盖。我试图在其类别标题下显示子类别文章。

例如以下结构:
主猫
   - Sub Cat
    - 第1条     - 第2条
    - Sub Cat
    - 第3条

此布局是文章应如何在主要博客覆盖上显示。例如,转到Main Cat将显示上述布局。

子类别以默认方式包含在内:

<?php if (!empty($this->children[$this->category->id]) && $this->maxLevel != 0) : ?>
    <div class="cat-children">
        <?php if ($this->params->get('show_category_heading_title_text', 1) == 1) : ?>
            <h3> <?php echo JText::_('JGLOBAL_SUBCATEGORIES'); ?></h3>
        <?php endif; ?>
        <?php echo $this->loadTemplate('children'); ?> </div>
<?php endif; ?>

在子覆盖中,包含标题,然后我们希望显示该子类别中的文章。

我尝试了多个不同版本的for each来处理子文章,但无法让它工作。 例如:

    <?php foreach ($this->child->children[$child->id] as $key => $item) : ?>
        1
        <?php echo $item->title; ?>
    <?php endforeach; ?>

0 个答案:

没有答案