This can be sen live at Meme or Lame / Published News
in header.tpl adding this code to where ever you want to display the categories strip.
Code:
{if $pagename eq 'published' || $pagename eq 'upcoming'}
{******Get the parent category******}
{assign var=requested_cat value=$request_category}
{* if story page - set the story's category to this *}
{if $pagename eq 'story'}
{assign var=requested_cat value='sub'}
{/if}
{assign var=mainCatStr value=''}
{assign var=parentCat value=-1}
{section name=thecat loop=$cat_array}
{if $cat_array[thecat].safename eq $requested_cat}
{if $cat_array[thecat].parent neq 0}
{assign var=parentCat value=$cat_array[thecat].parent}
{assign var=mainCatStr value=$cat_array[$parentCat].safename}
{else}
{assign var=parentCat value=$cat_array[thecat].auto_id}
{assign var=mainCatStr value=$cat_array[thecat].safename}
{/if}
{/if}
{/section}
{********* Displaying the Main categories *******************}
<div id="headbar" style="border-bottom:1px solid #ccc;padding-bottom:4px">
{section name=thecat loop=$cat_array}
{if $cat_array[thecat].parent eq 0}
{if $cat_array[thecat].safename eq $requested_cat || $cat_array[thecat].auto_id eq $parentCat}
{if $pagename eq "published"}
<a href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{else}
<a href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{/if}
{elseif $requested_cat eq "" && $cat_array[thecat].auto_id eq 0}
{if $pagename eq "published"}
<a href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{else}
<a href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{/if}
{else}
{if $pagename eq "published"}
<a href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{else}
<a href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{/if}
{/if}
{/if}
{/section}</div>
<br/>
{********* Displaying the Sub categories *******************}
<span>
{if $parentCat gt 0}
<div id= "headbar" style="border-bottom:1px solid #ccc;padding-bottom:4px">
{if $requested_cat eq $mainCatStr}
{if $pagename eq "published"}
<a href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{else}
<a href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{/if}
{else}
{if $pagename eq "published"}
<a href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{else}
<a href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{/if}
{/if}
{section name=thecat loop=$cat_array}
{if $cat_array[thecat].parent eq $parentCat}
{if $cat_array[thecat].safename eq $requested_cat}
{if $pagename eq "published"}
<a href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{else}
<a href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{/if}
{else}
{if $pagename eq "published"}
<a href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{else}
<a href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
{/if}
{/if}
{/if}
{/section}
</div>
{/if}</span>
{elseif $pagename neq 'submit'}
{********* Displaying the Main categories *******************}
<div style="border-bottom:1px solid #ccc;padding-bottom:4px">
{section name=thecat loop=$cat_array}
{if $cat_array[thecat].parent eq 0}
<a href="{$URL_maincategory, $cat_array[thecat].safename}">{$cat_array[thecat].name}</a>
{/if}
{/section}
<br/>
{else}<div id="border" style="border-bottom:6px solid #fff;padding:12px"></div>
{/if}
</ul></div>
1] If the page is published/upcoming - it tries to get the current category and highlight it
2] If the page is a story page only mai categories will get displayed[EDIT:]again we try to get the current category of the story and set a highlight class to it[/EDIT]
3] for other pages just display only the main categories.
the code will expand subcategories if user selects a main category or a story belong to a sub-category.
In submit we have taken care that user can select only sub-categories.






Linear Mode




