Joomla 3.5 - 修改“列出所有类别”菜单项样式

时间:2016-04-09 05:45:43

标签: templates joomla override

我的学生们正在创建一个投资组合艺术家网站。我们希望Joomla类别使用bootstrap类“span3”进行四行侦听。

我们需要为类别博客中的com_content / views / categories / tmpl / files提供模板覆盖。

非常感谢任何帮助。 彼得

1 个答案:

答案 0 :(得分:0)

请从以下路径打开文件

根==>模板==> yourtemplatename ==> HTML ==> com_content ==>类别==> default_items.php

删除所有代码并粘贴以下代码

<?php
defined('_JEXEC') or die;

JHtml::_('bootstrap.tooltip');

$class = ' class="span3"';
$lang  = JFactory::getLanguage();

$cols = 3;
$_cols  = 0;
$clear_class = '<div class="clearfix" style="clear:both;"></div>';  

if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
?>
    <?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
        <?php
        if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) :
        if (!isset($this->items[$this->parent->id][$id + 1]))
        {
            //$class = ' class="span3 last"';           
        }       
        if($_cols >= $cols) {
                echo $clear_class;              
            $_cols = 1;
        } else {
            ++$_cols;
        }       
        ?>
        <div <?php echo $class; ?> >
        <?php $class; ?>
            <h3 class="page-header item-title">
                <a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id, $item->language));?>">
                <?php echo $this->escape($item->title); ?></a>
                <?php if ($this->params->get('show_cat_num_articles_cat') == 1) :?>
                    <span class="badge badge-info tip hasTooltip" title="<?php echo JHtml::tooltipText('COM_CONTENT_NUM_ITEMS'); ?>">
                        <?php echo $item->numitems; ?>
                    </span>
                <?php endif; ?>
                <?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) : ?>
                    <a id="category-btn-<?php echo $item->id;?>" href="#category-<?php echo $item->id;?>"
                        data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span> </a>
                <?php endif;?>
            </h3>
            <?php if ($this->params->get('show_description_image') && $item->getParams()->get('image')) : ?>
                <img src="<?php echo $item->getParams()->get('image'); ?>" alt="<?php echo htmlspecialchars($item->getParams()->get('image_alt')); ?>" />
            <?php endif; ?>
            <?php if ($this->params->get('show_subcat_desc_cat') == 1) :?>
                <?php if ($item->description) : ?>
                    <div class="category-desc">
                        <?php echo JHtml::_('content.prepare', $item->description, '', 'com_content.categories'); ?>
                    </div>
                <?php endif; ?>
            <?php endif; ?>

            <?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) :?>
                <div class="collapse fade" id="category-<?php echo $item->id;?>">
                <?php
                $this->items[$item->id] = $item->getChildren();
                $this->parent = $item;
                $this->maxLevelcat--;
                echo $this->loadTemplate('items');
                $this->parent = $item->getParent();
                $this->maxLevelcat++;
                ?>
                </div>
            <?php endif; ?>
        </div>
        <?php endif; ?>
    <?php endforeach; ?>
<?php endif; ?>

enter image description here

相关问题