{**
* 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")
*}
{literal}
<style type="text/css">
a { color: black; }
.menu { margin: 5px; }
.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; }
.hidden {
visibility: hidden;
display: none; }
.visible {
visibility: visible;
display: block; }
</style>
<script type="text/javascript">
// Текущее выделенное меню
var secondLevelSelected = 0;
function overTopLevel(id){
var x;
if(secondLevelSelected){
x = document.getElementById("bar"+secondLevelSelected);
x.className = "hidden";
}
x = document.getElementById("bar"+id);
x.className = "visible";
secondLevelSelected = id;
}
</script>
{/literal}
{strip}
{if not $currentMenu}
<h1>Меню не найдено</h1>
{else}
<h1>{$currentMenu.NName}</h1>
{* Получаем пункты меню первого уровня *}
{xs2GetChildren var="menuItems1" ParId=$currentMenu.NodId NType="item" mod="menu"}
{foreach from=$menuItems1 item="it"}
{assign var="class" value="menu"}
{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}
<a href="{$it.href}" class="{$class}" onMouseOver="overTopLevel({$it.NodId})">
{$it.NName}
</a>
{/foreach}
{foreach from=$menuItems1 item="it1"}
<div class="hidden" id="bar{$it1.NodId}">
{* Получаем пункты меню второго уровня *}
{xs2GetChildren var="menuItems2" ParId=$it1.NodId NType="item" mod="menu"}
{foreach from=$menuItems2 item="it"}
{assign var="class" value="menu"}
{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>
{/foreach}
</div>
{/foreach}
{/if}
{/strip}
|
|