Advertisement
Guest User

Untitled

a guest
Nov 15th, 2016
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.02 KB | None | 0 0
  1. <div class="widget widgetMenu widgetMainMenu">
  2.     <ul>
  3.         <?= $this->getHelper('partialLoop')
  4.             ->setObjectKey('menuItem')
  5.             ->refVars('currentPage')
  6.             ->partialLoop('_partials/widget/menu/main/item.phtml', $this->menuItems) ?>
  7.      </ul>
  8. </div>
  9.  
  10.  
  11. Файл item.phtml
  12.  
  13. <?
  14.     $this->active = in_array($this->menuItem->pageId, $this->currentPage->pathIds);
  15.     $this->hasChildren = $this->active && count($this->menuItem->children);
  16. ?>
  17. <li<?= ($this->active ? ' class="active"' : ' class="inactive"') ?>>
  18.     <a href="<?= $this->pageUrl($this->menuItem) ?>"<?= ($this->hasChildren ? ' class="hasChildren"' : '') ?>>
  19.         <span class="menuItemContent">
  20.             <?= $this->menuItem->contents->name ?>
  21.         </span>
  22.     </a>
  23.     <? if($this->hasChildren): ?>      
  24.     <ul>
  25.         <?= $this->getHelper('partialLoop')
  26.             ->setObjectKey('menuItem')
  27.             ->refVars('currentPage')
  28.             ->partialLoop('_partials/widget/menu/main/item-2.phtml', $this->menuItem->children) ?>
  29.     </ul>
  30.     <? endif; ?>
  31. </li>
  32.  
  33.  
  34. Файл item-2.phtml
  35.  
  36. <?
  37.     $this->active = in_array($this->menuItem->pageId, $this->currentPage->pathIds);
  38.     $this->hasChildren = $this->active && count($this->menuItem->children);
  39. ?>
  40. <li<?= ($this->active ? ' class="active"' : ' class="inactive"') ?>>
  41.     <a href="<?= $this->pageUrl($this->menuItem) ?>">
  42.         <span class="menuItemContent">
  43.             <?= $this->menuItem->contents->name ?>
  44.         </span>
  45.     </a>
  46.     <? if($this->hasChildren): ?>
  47.     <ul>
  48.         <?= $this->getHelper('partialLoop')
  49.             ->setObjectKey('menuItem')
  50.             ->refVars('currentPage')
  51.             ->partialLoop('_partials/widget/menu/main/item-3.phtml', $this->menuItem->children) ?>
  52.     </ul>
  53.     <? endif; ?>
  54. </li>
  55.  
  56.  
  57. Файл item-3.phtml
  58.  
  59. <?
  60.     $this->active = in_array($this->menuItem->pageId, $this->currentPage->pathIds);
  61.     //$this->hasChildren = $this->active && count($this->menuItem->children);
  62. ?>
  63. <li<?= ($this->active ? ' class="active"' : ' class="inactive"') ?>>
  64.     <a href="<?= $this->pageUrl($this->menuItem) ?>">
  65.         <span class="menuItemContent">
  66.             <?= $this->menuItem->contents->name ?>
  67.         </span>
  68.     </a>
  69. </li>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement