Skip to content

Instantly share code, notes, and snippets.

@lucassmacedo
Created October 24, 2015 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucassmacedo/f77c3f29b84208c29719 to your computer and use it in GitHub Desktop.
Save lucassmacedo/f77c3f29b84208c29719 to your computer and use it in GitHub Desktop.
$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