Page 1 of 1

Graphical and non-graphical menu

Posted: Mon Aug 01, 2011 7:18 pm
by Steady
I'm building a site for a client who wants a menu on his site where the top level items are replaced by icons or images representing the main headings but with second and third tier menu items displayed as text. I've got the top level working:

Code: Select all

{foreach from=$nodelist item=node}
<a href="{$node->url}">
	<img src="/images/cms/{$node->alias}.jpg"
		alt="{$node->menutext}" title="{$node->menutext}" border="0" />
</a>
<br />
<br />
{/foreach}
but I'm struggling to figure out the next levels. I've looked at all the examples included with CMSMS but cannot figure out how to include next levels AND show them as text.
Regards, Edward

Re: Graphical and non-graphical menu

Posted: Tue Aug 02, 2011 2:49 pm
by opawaldburger
First of all: I hate the MenuManager, really ;)

But that's what came into my mind. This is not a code ready to be used, you need to implement it in your existing template.

Code: Select all

{assign var='number_of_levels' value=10000}
{if isset($menuparams.number_of_levels)}
{assign var='number_of_levels' value=$menuparams.number_of_levels}
{/if}

{if $number_of_levels == 1}
<!-- We're in the menu's top level. Use your code for displaying images. -->
{/if}

{if $number_of_levels > 1}
<!-- We're in one of the other levels. I'd recommend to use some code from one of the example-templates. -->
{/if}
I hope I helped a bit at least ;)

Re: Graphical and non-graphical menu

Posted: Thu Oct 06, 2011 8:34 pm
by Dr.CSS
Import the cssmenu.tpl and add this line to it wherever it calls for {$node->menutext}...

{if !empty($node->image)}<img src="{$node->image}" alt="{$node->menutext}" />{else}<span class='{$node->alias}'>{$node->menutext}</span>{/if}

You will need to pick the page image in the options tab when editing page, then if the top level pages have an image it will show if not it will show menu text as normal...