2016-04-09 2 views
0

с моими учениками мы создаем сайт портфолио художника. мы хотели бы иметь список категорий Joomla в четырех строках с классом bootstrap «span3».Joomla 3.5 - изменить "Список всех категорий" стиль меню

Для этого нам необходимо переопределить шаблон для com_content/views/categories/tmpl/files, как в блоге категории.

Любая помощь высоко оценена. Питер

ответ

0

Просьба открыть файл, используя путь

Root ==> Шаблоны ==> 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

+0

Привет Josef, спасибо много для быстрого и полезного ответа. он работает из коробки! есть только две небольшие проблемы. мы используем шаблон protostar, где первый интервал в строке получает класс .row-fluid [class * = "span"]: first-child с краем: 0. возможно ли получить этот класс после того, как строка полный и

? Когда все элементы визуализируются, будет clearfix nice. так что это не испортит остальную часть сайта. спасибо peter –

+0

Вы можете перезаписать css 'div.categories-list.span3: first-child {margin: 10px;}', а clearfix - это правильно, что означает: вы можете удалить –

+0

hi josef, я играл и нашел рабочее решение для меня. я изменил код в строке 11 из >> $ clear_class = '

'; << to >> $ clear_class = '
'; <<. теперь у меня есть первый класс после каждой строки. –

Смежные вопросы