mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-11-13 00:06:30 +00:00
Basic category layout (base on layout from com_contact)
This commit is contained in:
parent
c2084a7ff9
commit
70bb539931
@ -9,5 +9,12 @@
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$this->subtemplatename = 'items';
|
||||
echo JLayoutHelper::render('joomla.content.category_default', $this);
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
?>
|
||||
<div class="com-weblinks-category">
|
||||
<?php
|
||||
$this->subtemplatename = 'items';
|
||||
echo LayoutHelper::render('joomla.content.category_default', $this);
|
||||
?>
|
||||
</div>
|
@ -14,49 +14,40 @@ use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
||||
|
||||
$class = ' class="first"';
|
||||
if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) :
|
||||
if ($this->maxLevel != 0 && count($this->children[$this->category->id]) > 0) :
|
||||
?>
|
||||
<ul>
|
||||
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
|
||||
<?php
|
||||
if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) :
|
||||
if (!isset($this->children[$this->category->id][$id + 1]))
|
||||
{
|
||||
$class = ' class="last"';
|
||||
}
|
||||
?>
|
||||
<li<?php echo $class; ?>>
|
||||
<?php $class = ''; ?>
|
||||
<span class="item-title"><a href="<?php echo Route::_(RouteHelper::getCategoryRoute($child->id));?>">
|
||||
<?php echo $this->escape($child->title); ?></a>
|
||||
</span>
|
||||
<ul class="com-weblinks-category__children list-striped list-condensed">
|
||||
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
|
||||
<?php if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) : ?>
|
||||
<li>
|
||||
<h4 class="item-title">
|
||||
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($child->id, $child->language)); ?>">
|
||||
<?php echo $this->escape($child->title); ?>
|
||||
</a>
|
||||
|
||||
<?php if ($this->params->get('show_subcat_desc') == 1) :?>
|
||||
<?php if ($child->description) : ?>
|
||||
<div class="category-desc">
|
||||
<?php echo HTMLHelper::_('content.prepare', $child->description, '', 'com_weblinks.category'); ?>
|
||||
</div>
|
||||
<?php if ($this->params->get('show_cat_items') == 1) : ?>
|
||||
<span class="badge bg-info float-end" title="<?php echo Text::_('COM_WEBLINKS_CAT_NUM'); ?>"><?php echo $child->numitems; ?></span>
|
||||
<?php endif; ?>
|
||||
</h4>
|
||||
|
||||
<?php if ($this->params->get('show_subcat_desc') == 1) : ?>
|
||||
<?php if ($child->description) : ?>
|
||||
<div class="category-desc">
|
||||
<?php echo HTMLHelper::_('content.prepare', $child->description, '', 'com_weblinks.category'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($child->getChildren()) > 0 ) :
|
||||
$this->children[$child->id] = $child->getChildren();
|
||||
$this->category = $child;
|
||||
$this->maxLevel--;
|
||||
echo $this->loadTemplate('children');
|
||||
$this->category = $child->getParent();
|
||||
$this->maxLevel++;
|
||||
endif; ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->params->get('show_cat_num_links') == 1) :?>
|
||||
<dl class="weblink-count"><dt>
|
||||
<?php echo Text::_('COM_WEBLINKS_NUM'); ?></dt>
|
||||
<dd><?php echo $child->numitems; ?></dd>
|
||||
</dl>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($child->getChildren()) > 0 ) :
|
||||
$this->children[$child->id] = $child->getChildren();
|
||||
$this->category = $child;
|
||||
$this->maxLevel--;
|
||||
echo $this->loadTemplate('children');
|
||||
$this->category = $child->getParent();
|
||||
$this->maxLevel++;
|
||||
endif; ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif;
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
Loading…
Reference in New Issue
Block a user