Skip to content

Instantly share code, notes, and snippets.

@hailwood
Created August 21, 2013 00:30
Show Gist options
  • Save hailwood/6289081 to your computer and use it in GitHub Desktop.
Save hailwood/6289081 to your computer and use it in GitHub Desktop.
{function tree depth=0}
<li {if $active}class="active"{/if}>
<a style="margin-left:{$depth*10}px" data-needs-tooltip="true" title="{$c.category->data('page_title')}"
data-placement="left"
href="/community/blog/category/{$c.category->data('id')}/{$c.category->data('slug')}">
{$c.category->data('menu_title')}
<small class="text-muted pull-right">{$c.category->data('posts')|number_format} posts</small>
</a>
</li>
{if $c.children}
{foreach $c.children as $child}
{tree c=$child depth=depth+1 active=($category && $category->data('id') == $child.category->data('id')) }
{/foreach}
{/if}
{/function}
<div class="blog-side-bar">
<div class="blog-categories widget-tp">
<h3><i class="icon-th-list"></i> Categories</h3>
<ul>
{if $blog_categories}
{foreach $blog_categories as $c}
{call name="tree" c=$c active=($category && $category->data('id') == $c.category->data('id'))}
{/foreach}
{/if}
</ul>
</div>
<div class="blog-categories widget-tp">
<h3><i class="icon-tags"></i> Tags</h3>
{if $blog_tags}
{foreach $blog_tags as $t}
<a href="/community/tag/{$t->data('id')}/{$t->data('name')}">
<span class="label label-info" style="padding:9px 10px;font-weight:300;">
{$t->data('name')}
</span>
</a>
{/foreach}
{/if}
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment