Created
October 24, 2015 19:55
-
-
Save lucassmacedo/f77c3f29b84208c29719 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$categories = $CategoryModel->find('threaded', array( | |
'conditions' => array( | |
'Category.home' => true, | |
'Category.visible' => true, | |
'Category.active' => true, | |
), | |
)); | |
foreach ($categories as $item) { | |
extract($item); | |
echo '<li class="sidebar-menu-item">'; | |
$linkPrincipal = "/{$Category['slug']}-{$Category['id']}"; | |
$nomePrincipal = $Category['name']; | |
echo $this->Html->link( | |
$Category['name'], | |
"/{$Category['slug']}-{$Category['id']}", | |
array('title' => $Category['title']) | |
); | |
if (!empty($children)) { | |
echo '<ul class="submenu">'; | |
foreach ($children as $item) { | |
extract($item); | |
echo '<li class="submenu-item">'; | |
echo $this->Html->link( | |
$Category['name'], | |
"/{$Category['slug']}-{$Category['id']}", | |
array('title' => $Category['title']) | |
); | |
if (!empty($children)) { | |
if (!empty($currentCategory)) { | |
echo '<span class="submenu-toggle toggled"></span>'; | |
echo '<ul class="submenu" style="display: block;">'; | |
} else { | |
echo '<span class="submenu-toggle"></span>'; | |
echo '<ul class="submenu">'; | |
} | |
foreach ($children as $item) { | |
extract($item); | |
echo '<li class="submenu-item">'; | |
echo $this->Html->link( | |
$Category['name'], | |
"/{$Category['slug']}-{$Category['id']}", | |
array('title' => $Category['title']) | |
); | |
echo '</li>'; | |
} | |
echo '</ul>'; | |
} | |
echo '</li>'; | |
} | |
echo '</ul>'; | |
} | |
echo '</li>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment