Graphical and non-graphical menu

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Steady
New Member
New Member
Posts: 6
Joined: Mon Apr 21, 2008 9:54 pm

Graphical and non-graphical menu

Post 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
User avatar
opawaldburger
Forum Members
Forum Members
Posts: 94
Joined: Tue Nov 04, 2008 2:10 pm

Re: Graphical and non-graphical menu

Post 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 ;)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Graphical and non-graphical menu

Post 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...
Post Reply

Return to “Modules/Add-Ons”