Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1. <?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
  2. <?
  3. $countItems = 0;
  4. $oldItemNumber = 0;
  5. $Items =array();
  6. $Items1 = array();
  7. $Items2 = array();
  8. $Items3 = array();
  9. foreach ($arResult as $arItem){
  10.     if ($arItem["DEPTH_LEVEL"] == 3){
  11.         if ($oldItemNumber+1 == $arItem["ITEM_INDEX"]){
  12.             if($countItems%3 == 0){
  13.                 $Items1[] = $arItem;
  14.             }
  15.             if($countItems%3 == 1){
  16.                 $Items2[] = $arItem;
  17.             }
  18.             if($countItems%3 == 2){
  19.                 $Items3[] = $arItem;
  20.             }
  21.             $oldItemNumber++;
  22.             $countItems++;
  23.         }
  24.     }
  25.     else{
  26.         if ($countItems != 0){
  27.             array_push($Items1,"</li><li>");
  28.             array_push($Items2,"</li><li>");
  29.         }
  30.         $Items = array_merge($Items,$Items1,$Items2,$Items3);
  31.         $Items1 = array();
  32.         $Items2 = array();
  33.         $Items3 = array();
  34.         $oldItemNumber = $arItem["ITEM_INDEX"];
  35.         $countItems = 0;
  36.     }
  37. }
  38. $count = 0;
  39. foreach ($arResult as $arItem){
  40.     if ($arItem["DEPTH_LEVEL"] == 3){
  41.         if ($oldItemNumber+1 == $arItem["ITEM_INDEX"]) {
  42.             if ($Items[$count+1] == "</li><li>"){
  43.                 $Items[$count]["PARAMS"]["END_TAG"] = "</li><li>";
  44.             }
  45.             $arResult[$arItem["ITEM_INDEX"]+1] = $Items[$count];
  46.             $count++;
  47.             if ($Items[$count] == "</li><li>"){
  48.                 $count++;
  49.             }
  50.             $oldItemNumber++;
  51.         }
  52.     }
  53.     else{
  54.         $oldItemNumber = $arItem["ITEM_INDEX"];
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement