Отформатированный шаблон родного горизонтального мультилевольного меню

<p>Для удобства отформатировал шаблон левого вертекального меню в php. Лично мне удобней использовать стиль фигурных скобок { } вместо if: else: endif;</p>

<p>Если кому пригодится буду рад =)</p>

<pre class="brush: php">

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>

<?
if (!empty($arResult))
{
    ?>
    <div id="left"  class="our_manufacture">
        <ul id="nav_list_first" class="nav_list">

        <?
        $previousLevel = 0;
        foreach($arResult as $arItem)
        {
            if ($previousLevel && $arItem["DEPTH_LEVEL"] < $previousLevel)
                echo str_repeat("</ul></li>", ($previousLevel - $arItem["DEPTH_LEVEL"]));

            if ($arItem["IS_PARENT"])
            {
                if ($arItem["DEPTH_LEVEL"] == 1)
                {
                    ?>
                    <li><a href="<?=$arItem["LINK"]?>" class="<?if ($arItem["SELECTED"]):?>root-item-selected<?else:?>root-item<?endif?>"><?=$arItem["TEXT"]?></a>
                        <ul class="root-item">
                    <?
                }
                else
                {
                    ?>
                    <li><a href="<?=$arItem["LINK"]?>" class="parent<?if ($arItem["SELECTED"]):?> item-selected<?endif?>"><?=$arItem["TEXT"]?></a>
                        <ul>
                    <?
                }
            }
            else
            {
                if ($arItem["PERMISSION"] > "D")
                {
                    if ($arItem["DEPTH_LEVEL"] == 1)
                    {
                        ?>
                        <li><a href="<?=$arItem["LINK"]?>" class="<?if ($arItem["SELECTED"]):?>root-item-selected<?else:?>root-item<?endif?>"><?=$arItem["TEXT"]?></a></li>
                        <?
                    }
                    else
                    {
                        ?>
                        <li><a href="<?=$arItem["LINK"]?>" <?if ($arItem["SELECTED"]):?> class="item-selected"<?endif?>><?=$arItem["TEXT"]?></a></li>
                        <?
                    }
                }
                else
                {
                    if ($arItem["DEPTH_LEVEL"] == 1)
                    {
                        ?>
                        <li><a href="" class="<?if ($arItem["SELECTED"]):?>root-item-selected<?else:?>root-item<?endif?>" title="<?=GetMessage("MENU_ITEM_ACCESS_DENIED")?>"><?=$arItem["TEXT"]?></a></li>
                        <?
                    }
                    else
                    {
                        ?>
                        <li><a href="" class="denied" title="<?=GetMessage("MENU_ITEM_ACCESS_DENIED")?>"><?=$arItem["TEXT"]?></a></li>
                        <?
                    }
                }
            }
            $previousLevel = $arItem["DEPTH_LEVEL"];
        }

        if ($previousLevel > 1)//close last item tags
            echo str_repeat("</ul></li>", ($previousLevel-1) );
        ?>

        </ul>
    </div>
    <?
}

</pre>

Возврат к списку


Текст сообщения*
Защита от автоматических сообщений