Page 1 of 1
How to add sub-title to menu
Posted: Wed May 06, 2015 9:31 am
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
Re: How to add sub-title to menu
Posted: Wed May 06, 2015 10:06 am
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).
Re: How to add sub-title to menu
Posted: Wed May 06, 2015 12:01 pm
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
Re: How to add sub-title to menu
Posted: Wed May 06, 2015 12:06 pm
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.
Re: How to add sub-title to menu
Posted: Wed May 06, 2015 2:03 pm
by Barrowboy
Hi again
I've got it working just need to find how to add some css to it now.
Many thanks.
Re: How to add sub-title to menu
Posted: Wed May 06, 2015 2:31 pm
by Barrowboy
Hi Velden
All done just thought you would like to see your handy work of the finished menu.
Image attached.
Many thanks