Source Code for Me (s-c.me)

Allows you to paste souce code to blogs! Adapted for Twitter! Here is Search Form in case you missed your code.
Tags: Php,$IBLOCK_ID,$ROOT_SECTION_ID,$APPLICATION,$rsSections,$arSection,$arrAddLinks, Created At: 10/24/2016 8:08:56 PMViews:

HTML view:
Copy Source | Copy HTML
<?
$IBLOCK_ID = 18;
$ROOT_SECTION_ID =  0;
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
global $APPLICATION;
if (CModule::IncludeModule("iblock")) {
$rsSections = GetIBlockSectionList($IBLOCK_ID, false, array("SORT" => "ASC", "ID" => "ASC"), false, array("ACTIVE"=>"Y"));
while ($arSection = $rsSections->Fetch())
{
    $arrAddLinks = array(SITE_DIR."services/.php?SECTION_ID=".$arSection["ID"]);
    // пройдемся по элементам раздела
    if ($rsElements = GetIBlockElementListEx($IBLOCK_TYPE, false, false, array(), false, array("ACTIVE" => "Y", "IBLOCK_ID" => $IBLOCK_ID, "SECTION_ID" => $arSection["ID"]), array("ID", "NAME")))
    {
        while ($arElement = $rsElements->GetNext()) {/*debugmessage($arElement);*/$arrAddLinks[] = array("ID" => $arElement["ID"], "NAME" => $arElement["NAME"]);}
    }
    if (count($arrAddLinks) > 1) $isParent = true; else $isParent = false;
        $aMenuLinksNew[] = array(
        $arSection["NAME"],
        "",
        false,
        array("FROM_IBLOCK" => 1, "DEPTH_LEVEL" => 1, "IS_PARENT" => $isParent)
    );
        if (count($arrAddLinks) > 1)
    foreach ($arrAddLinks as $item_data) {
        if ($item_data["NAME"] == "/") {
            $item_index_current --;
            continue;
        }
        $aMenuLinksNew[] = array(
            $item_data["NAME"],
            SITE_DIR."services/".$item_data["ID"]."/",
            false,
            array("FROM_IBLOCK" => 1, "DEPTH_LEVEL" => 2)
        );
        $item_index_current ++;
    }
    $item_index_current =  0;
    unset($arrAddLinks);
    $itemIndex ++;
}
$aMenuLinks = array_merge($aMenuLinks, $aMenuLinksNew);
}
?>

Based on Manoli.Net's CodeFormatter. Made by Topbot (c) 2008-2017