Is it possible to display news categories as a menu item? I'm looking for documentation on this, done the Google searches, etc, but can't find information.
What I essentially want are two menus on my website, one which contains all the content, and one which contains news items. The menu for the news would show the category of news, and then on a hover over show all news articles in that particular category.
I've sorted out menu manager for my content by copy and pasting (and slightly editing) someone else's code, which I've included below.
I don't know if changing this menu to include news items is something simple I'm missing, or something more complex involving changing the actual code. If the later, I realise that it may be a lot to ask so I'm willing to work it out myself if someone could point me in the right direction for documentation to look at.
(I would just use normal content for the second menu and use the exclude prefix part to separate it out, but I need to be able to set the content to only go live at a certain time. Furthermore, I would just use AdvancedContent, but I also need to use the {recently_updated} tag to display a link to the most recent new content/news article on the home page)
Thanks,
---------
Code: Select all
{strip}
{if $count > 0}
<ul id="menu" class="clearfix">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{if $node->depth == 2}<div class="submenu clearfix"> {/if} {* if depth 2 add div to wrap elements *}
{repeat string='<ul class="clearfix">' times=$node->depth-$node->prevdepth} {* then continue with usual unordered list *}
{elseif $node->depth < $node->prevdepth}
{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
{if $node->depth == 2}</li>{/if}
{if $node->depth == 1}</div></li>{/if} {* close open div's *}
{elseif $node->index > 0}</li>{/if}
{if $node->current == true && $node->depth > 1} {* if item is active and depth greate 1 *}
<li class='item{if ($node->haschildren != '1')} no-sub{/if}{if !empty($node->extra1)} {$node->extra1}{/if}'>
<a class="current" href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>
<span>{$node->menutext}</span>
{if !empty($node->titleattribute)}<span class='info'>{$node->titleattribute}</span>{/if}{* is there text in options description? *}
{if !empty($node->thumbnail) && ($node->depth != 1)}<span class='thumb'><img src='{$node->thumbnail}' alt='{$node->menutext}' /></span>{/if} {* was a thumbnail selected from options? *}
</a> {elseif ($node->current == true) or ($node->parent == true)} {* if item is current and has children *}
<li class='item current{if ($node->haschildren != '1')} no-sub{/if}{if !empty($node->extra1)} {$node->extra1}{/if}'>
<a href="{$node->url}" class="menuitem submenuheader current"{if $node->target ne ""} target="{$node->target}"{/if}>
<span>{$node->menutext}</span> {if !empty($node->titleattribute)}<span class='info'>{$node->titleattribute}</span>{/if}
{if !empty($node->thumbnail) && ($node->depth != 1)}<span class='thumb'><img src='{$node->thumbnail}' alt='{$node->menutext}' /></span>{/if}
</a>
{elseif $node->haschildren == true && $node->depth > 1} {* if item has children and depth is greater 1 *}
<li class='item{if ($node->haschildren != '1')} no-sub{/if}{if !empty($node->extra1)} {$node->extra1}{/if}'>
<a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>
<span>{$node->menutext}</span>
{if !empty($node->titleattribute)}<span class='info'>{$node->titleattribute}</span>{/if}
{if !empty($node->thumbnail) && ($node->depth != 1)}<span class='thumb'><img src='{$node->thumbnail}' alt='{$node->menutext}' /></span>{/if}
</a> {elseif $node->haschildren == true} {* if item has children *}
<li class='item{if ($node->haschildren != '1')} no-sub{/if}{if !empty($node->extra1)} {$node->extra1}{/if}'>
<a href="{$node->url}" class="menuitem submenuheader"{if $node->target ne ""} target="{$node->target}"{/if}>
<span>{$node->menutext}</span>
{if !empty($node->titleattribute)}<span class='info'>{$node->titleattribute}</span>{/if}
</a>
{elseif $node->depth > 1} {* if depth is greater 1 *}
<li class='item{if ($node->haschildren != '1')} no-sub{/if}{if !empty($node->extra1)} {$node->extra1}{/if}'>
<a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>
<span>{$node->menutext}</span>
{if !empty($node->titleattribute)}<span class='info'>{$node->titleattribute}</span>{/if}
{if !empty($node->thumbnail) && ($node->depth != 1)}<span class='thumb'><img src='{$node->thumbnail}' alt='{$node->menutext}' /></span>{/if}
</a>
{elseif $node->type == 'sectionheader' && $node->haschildren == false} {* no link just sectionheader *}
<li class='item{if ($node->haschildren != '1')} no-sub{/if}{if !empty($node->extra1)} {$node->extra1}{/if}'>
<span href="{$node->url}" class="menuitem sectionheader"{if $node->target ne ""} target="{$node->target}"{/if}>
<span>{$node->menutext}</span>
{if !empty($node->titleattribute)}<span class='info'>{$node->titleattribute}</span>{/if}
</a>
{elseif $node->type == 'sectionheader' && $node->haschildren == true} {* if sectionheader has children *}
<li class='item{if ($node->haschildren != '1')} no-sub{/if}{if !empty($node->extra1)} {$node->extra1}{/if}'>
<span class="menuitem submenuheader sectionheader"{if $node->target ne ""} target="{$node->target}"{/if}>
<span>{$node->menutext}</span>
{if !empty($node->titleattribute)}<span class='info'>{$node->titleattribute}</span>{/if}
</span>
{else} {* anything else *}
<li class='item{if ($node->haschildren != '1')} no-sub{/if}{if !empty($node->extra1)} {$node->extra1}{/if}'>
<a class="menuitem" href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>
<span>{$node->menutext}</span>
{if !empty($node->titleattribute)}<span class='info'>{$node->titleattribute}</span>{/if}
{if !empty($node->thumbnail) && ($node->depth != 1)}<span class='thumb'><img src='{$node->thumbnail}' alt='{$node->menutext}' /></span>{/if}
</a>
{/if}{/foreach}{repeat string="</li></ul>" times=$node->depth-1}</li></ul>{/if}
{/strip}