How to add sub-title to menu

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
Barrowboy
Forum Members
Forum Members
Posts: 223
Joined: Mon Dec 16, 2013 4:09 pm

How to add sub-title to menu

Post by Barrowboy »

Hi

I am trying to add a non linkable sub title to a menu item
something like this:

Test Page (link to page)
subtitle (short description)

I have put this code in the template:
<h2>{content block="Subtitle" oneline="true" wysiwyg="false"}</h2>
Which gives me a one line entry in the admin but how can this be shown on a menu below the page link.
I am using the latest version of CMSMS

I trust that makes some sense.

Thanks
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: How to add sub-title to menu

Post by velden »

You could use CGSimpleSmarty to get the contents of that content block. Read the help of that module to find to proper method.

That said, think about this:

Pages have three extra fields named 'Extra Page Attribute n' which by default are on the Options tab when you add/edit a page.
Those fields are 'cheaper' to use as they (by default) will be available in the Menu Manager (if NOT loadprops=0 is used in the {menu} tag).

You can use the field in Menu Manager template by {$node->extra1} (or 2 or 3).

To get that field to the main tab have a look at the 'Basic Properties' multi-select field in Site Admin > Global Settings > Content Editing Settings.
You can't however not set another label (unless you're willing to use a custom admin template for that action).
Barrowboy
Forum Members
Forum Members
Posts: 223
Joined: Mon Dec 16, 2013 4:09 pm

Re: How to add sub-title to menu

Post by Barrowboy »

Hi Velden
Thanks for your reply. I like the idea of using standard items but I've got myself lost in the process.

I am using the standard template simple_navigation.tpl and added the menu to a page but stripped out the top level with this {menu start_level='2' collapse='1' } I am trying to add the subtitle with this level.

In the template I have removed the loadprops=0 from the tag.

But unable to figure out were to set / add the {$node->extra1} in the template. Can you explain a little deeper.

Thanks
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: How to add sub-title to menu

Post by velden »

If you're using a standard menu template you need to copy it to the database to be able to customize it. I assume you know about that?

You then make it either the default Menu Manager template or use the template parameter in the {menu} tag.

Then within the foreach loop of Menu Manager template, wherever you need the sub title to appear you can use the {$node->extra1} 'variable'

Or something like (untested): {if !empty($node->extra1)}{$node->extra1}{/if}

Obviously something should be filled in that field per page.
Barrowboy
Forum Members
Forum Members
Posts: 223
Joined: Mon Dec 16, 2013 4:09 pm

Re: How to add sub-title to menu

Post by Barrowboy »

Hi again

I've got it working just need to find how to add some css to it now.

Many thanks.
Barrowboy
Forum Members
Forum Members
Posts: 223
Joined: Mon Dec 16, 2013 4:09 pm

Re: How to add sub-title to menu

Post by Barrowboy »

Hi Velden

All done just thought you would like to see your handy work of the finished menu.
Projects layout.jpg
Image attached.

Many thanks
Post Reply

Return to “The Lounge”