{**
* XS2: Пример простой древовидной навигационной структуры на четыре уровня
*
* This file is developed by Solutecs, LLC for the purpose of the company
* and is provided together with XS2 Framework as and inherent part of the
* system. This file can be used on the terms of License Agreement.
*
* +7 (495) 585-0833 / 13 Rusakovskaya street, Moscow 107140 Russia
*
* @link http://www.solutecs.com
* @copyright ©1998-2007 Solutecs, LLC
* @version 1.XX
*}
{*
Отображение разного вида задается классами в таблице стилей для:
1. Текущего пункта ("current")
2. Предков текущего ("ancestor")
3. Детей текущего ("child")
4. Братьев текущего ("sibling")
Отступ определяется классами для уровеней вложенности пунктов меню:
1. Первого ("menu2")
2. Второго ("menu3")
3. Третьего ("menu4")
4. Четвертого ("menu5")
*}
{literal}
<style type="text/css">
a { color: black; }
.current { font-weight: bold; color: red; text-decoration: none; border: 1px solid red; }
.ancestor { font-weight: bold; color: blue; }
.child { font-weight: bold; color: green; }
.sibling { font-weight: bold; }
.menu2 { margin-left: 10px; }
.menu3 { margin-left: 60px; }
.menu4 { margin-left: 110px; }
.menu5 { margin-left: 160px; }
</style>
{/literal}
{strip}
{if not $currentMenu}
<h1>Меню не найдено</h1>
{else}
<h1>{$currentMenu.NName}</h1>
{* Получаем пункты меню *}
{xs2GetKnee var="menuItems" ParId=$currentMenu.NodId NType="item" mod="menu" branch=1}
{foreach from=$menuItems item="it"}
{* Выводить только четыре уровня *}
{if $it.NDeep <= 5}
{* Отступ *}
{assign var="class" value="menu"|cat:$it.NDeep}
{isAncestor node=$it currentItem=$currentItem var="iss"}
{if $iss}
{* Если данный пункт - предок теущего *}
{assign var="class" value=$class|cat:" ancestor"}
{/if}
{if $it.NodId eq $currentItem.NodId}
{* Если данный пункт - текущий *}
{assign var="class" value=$class|cat:" current"}
{/if}
{if ($currentItem.ParId eq $it.ParId) and ($currentItem.NodId neq $it.NodId)}
{* Если данный пункт - брат текущего *}
{assign var="class" value=$class|cat:" sibling"}
{/if}
{if $currentItem.NodId eq $it.ParId}
{* Если данный пункт - ребенок текущего *}
{assign var="class" value=$class|cat:" child"}
{/if}
<a href="{$it.href}" class="{$class}">{$it.NName}</a>
<br>
{/if}
{/foreach}
{/if}
{/strip}
|
|