Solution Technologies
Управление сайтом без ограничений
{**
 * 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. Текущего (квадратные скобки и жирный шрифт)
  2. Предков текущего (жирный шрифт)
  3. Детей текущего (маркер перед названием)
  4. Братьев текущего (курсив)
*}

{strip}

{if not $currentMenu}
  <h1>Меню не найдено</h1>
{else}

  <h1>{$currentMenu.NName}</h1>

  {xs2GetChildren ParId=$currentMenu.NodId NType="item" var="m1"} {* Первый уровень *}
  {foreach from=$m1 item="i1"}

    {* Если данный пункт - предок теущего *}
    {isAncestor node=$i1 currentItem=$currentItem var="iss"}
    {if $iss}<b>{/if}
    {* Если данный пункт - текущий *}
    {if $i1.NodId eq $currentItem.NodId}<b>[&nbsp;{/if}
    {* Если данный пункт - брат текущего *}
    {if ($currentItem.ParId eq $i1.ParId) and ($currentItem.NodId neq $i1.NodId)}<i>{/if}
    <a href="{$i1.href}">{$i1.NName}</a>
    {if ($currentItem.ParId eq $i1.ParId) and ($currentItem.NodId neq $i1.NodId)}</i>{/if}
    {if $i1.NodId eq $currentItem.NodId}&nbsp;]</b>{/if}
    {if $iss}</b>{/if}
    <br>

    {* Второй уровень *}
    {xs2GetChildren ParId=$i1.NodId NType="item" var="m2"}
    {foreach from=$m2 item="i2"}

      {* Отступ *}
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      {* Если данный пункт - ребенок текущего *}
      {if $currentItem.NodId eq $i2.ParId}&bull;&nbsp;{/if}
      {isAncestor node=$i2  currentItem=$currentItem var="iss"}
      {if $iss}<b>{/if}
      {if $i2.NodId eq $currentItem.NodId}<b>[&nbsp;{/if}
      {if ($currentItem.ParId eq $i2.ParId) and ($currentItem.NodId neq $i2.NodId)}<i>{/if}
      <a href="{$i2.href}">{$i2.NName}</a>
      {if ($currentItem.ParId eq $i2.ParId) and ($currentItem.NodId neq $i2.NodId)}</i>{/if}
      {if $i2.NodId eq $currentItem.NodId}&nbsp;]</b>{/if}
      {if $iss}</b>{/if}
      <br>

      {* Третий уровень *}
      {xs2GetChildren ParId=$i2.NodId NType="item" var="m3"}
      {foreach from=$m3 item="i3"}
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        {if $currentItem.NodId eq $i3.ParId}&bull;&nbsp;{/if}
        {isAncestor node=$i3 currentItem=$currentItem var="iss"}
        {if $iss}<b>{/if}
        {if $i3.NodId eq $currentItem.NodId}<b>[&nbsp;{/if}
        {if ($currentItem.ParId eq $i3.ParId) and ($currentItem.NodId neq $i3.NodId)}<i>{/if}
        <a href="{$i3.href}">{$i3.NName}</a>
        {if ($currentItem.ParId eq $i3.ParId) and ($currentItem.NodId neq $i3.NodId)}</i>{/if}
        {if $i3.NodId eq $currentItem.NodId}&nbsp;]</b>{/if}
        {if $iss}</b>{/if}
        <br>

        {* Четвертый уровень *}
        {xs2GetChildren ParId=$i3.NodId NType="item" var="m4"}
        {foreach from=$m4 item="i4"}
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          {if $currentItem.NodId eq $i4.ParId}&bull;&nbsp;{/if}
          {isAncestor node=$i4 currentItem=$currentItem var="iss"}
          {if $iss}<b>{/if}
          {if $i4.NodId eq $currentItem.NodId}<b>[&nbsp;{/if}
          {if ($currentItem.ParId eq $i4.ParId) and ($currentItem.NodId neq $i4.NodId)}<i>{/if}
          <a href="{$i4.href}">{$i4.NName}</a>
          {if ($currentItem.ParId eq $i4.ParId) and ($currentItem.NodId neq $i4.NodId)}</i>{/if}
          {if $i4.NodId eq $currentItem.NodId}&nbsp;]</b>{/if}
          {if $iss}</b>{/if}
          <br>

        {/foreach}

      {/foreach}

    {/foreach}

  {/foreach}

{/if}

{/strip}
Copyright ©1998-2008 Солютекс. Все права защищены.
Этот сайт сделан в designLab | Работает на технологии XS2
Условия использования | О защите конфиденциальности