Navigation Select
Verfasst: Di 9. Jul 2013, 20:09
Hallo,
ich verwende dieses Navigationsmodul s.u. Allerdings wird der entsprechende Navigationspunkt nicht auf "activ" css Klasse gesetzt. Wie kann man das definieren oder abfragen?
und get.tpl ist
ich verwende dieses Navigationsmodul s.u. Allerdings wird der entsprechende Navigationspunkt nicht auf "activ" css Klasse gesetzt. Wie kann man das definieren oder abfragen?
Code: Alles auswählen
<?php
/**
* description: main navigation
*
* @package Module
* @subpackage NavigationTop
* @version SVN Revision $Rev:$
*
* @author marcus.gnass@4fb.de
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
// assert framework initialization
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
// get client settings
$rootIdcat = getEffectiveSetting('navigation_main', 'idcat', 68);
$depth = getEffectiveSetting('navigation_main', 'depth', 3);
// get category tree
$categoryHelper = cCategoryHelper::getInstance();
$categoryHelper->setAuth(cRegistry::getAuth());
$tree = $categoryHelper->getSubCategories($rootIdcat, $depth);
// get path (breadcrumb) of current category
function navigation_main_filter(cApiCategoryLanguage $categoryLanguage) {
return $categoryLanguage->get('idcat');
}
$path = array_map('navigation_main_filter', $categoryHelper->getCategoryPath(cRegistry::getCategoryId(), 1));
$path = 68;
// use template to display navigation
$tpl = cSmartyFrontend::getInstance();
$tpl->assign('tree', $tree);
$tpl->assign('path', $path);
$tpl->display('get.tpl');
?>
und get.tpl ist
Code: Alles auswählen
<!-- navigation_main/template/get.tpl -->
<ul>
{foreach from=$tree item=wrapper}
{assign var="idcat" value=$wrapper.idcat}
{assign var="url" value=$wrapper.item->getLink()}
{assign var="name" value=$wrapper.item->get('name')}
{if $idcat|in_array:$path}
{assign var="aClass" value='active'}
{/if}
<li>
<a class="{$aClass}" href="{$url}" title="{$name}">{$name}</a>
{if $idcat|in_array:$path}
{include file="navigation_main/template/get.tpl"
tree=$wrapper.subcats path=$path}
{/if}
</li>
{/foreach}
</ul>
<!-- /navigation_main/template/get.tpl -->