W
W
Whiteweb2014-11-21 21:49:51
PHP
Whiteweb, 2014-11-21 21:49:51

How to put #SECTION_CODE# instead of ID?

<?$APPLICATION->SetPageProperty("maket", "special");?>
      <input type='hidden' value='<?=$_REQUEST["sect_id"]?>' id='section_id'/>
      <ul class="categories_new">
        <li class="<?=(empty($_REQUEST['sect_id']) ? active : "")?>"><a href="/special/" data-filter="*">Все</a></li>
        <? if(CModule::IncludeModule("iblock"))
        {
          //print_r($arResult);
          $sec=CIBlockSection::GetList(Array("SORT"=>"ASC", "IBLOCK_SECTION_ID"=>"DESC"),Array("IBLOCK_ID"=>"6", "ACTIVE"=>"Y"));
          $sect_arr = array();
          
          while($item=$sec->GetNext())
          {
            if($item['DEPTH_LEVEL'] == 1)
              $sect_arr[] = $item;
            else
              $sect_arr2[] = $item;
          }

          

          foreach($sect_arr as $sect_first)
          {
          $sect_depth = 1;
        ?><li class="<?=((($_REQUEST['sect_id'] == $sect_first['ID']) || ($_REQUEST['sect_id'] == $sect_first['ID'])) ? active : '')?>"><a data-filter='.<?=$sect_first["ID"]?>' href='?sect_id=<?=$sect_first['ID']?>'><?=$sect_first['NAME']?></a>
          <?
          foreach($sect_arr2 as $sect_first2)
          {
            if($sect_first2['IBLOCK_SECTION_ID'] == $sect_first['ID'])
            {
              if($sect_depth)
              {
                echo "<div class='groups_menu_sec_lvl'><ul>";
                ?> <li class="<?=(($_REQUEST['sect_id'] == $sect_first['ID']) ? active : "")?>"><a class='is_close' data-filter='.<?=$sect_first["ID"]?>' href='#'>Все</a></li> <?
                $sect_depth = 0;
              }
              ?>
              <li class="<?=(($_REQUEST['sect_id'] == $sect_first2['ID']) ? active : '')?>"><a class='is_close' data-filter='.<?=$sect_first2["ID"]?>' href='?sect_id=<?=$sect_first2['ID']?>'><?=$sect_first2['NAME']?></a>
              <?
              
            }

          }
          if(!$sect_depth)
              echo "</ul></div>";
          ?>
          </li><?
          }
        }
        ?>
      </ul>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2014-11-21
@Whiteweb

You need to set the text cursor to the left of the letter D in the word ID, press Backspace twice, and then, while holding down the Shift button and successively pressing the keys with the symbols #, S, E, C, T, I, O, N, _, C, O, D,E and # enter #SECTION_CODE# in its place.

B
Boris Benkovsky, 2014-11-21
@benbor

There is no desire here not to freelance anyone for you, let alone to do JS in your head. Do not be too lazy to make jsfiddle, maybe someone would look

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question