Menu attributes
Menu attributes
Can someone explain how to use the Extra Page Attribute 1
I would like to add a further message on the menu.
The system is the latest version and I am using theme bandb.
Thanks
I would like to add a further message on the menu.
The system is the latest version and I am using theme bandb.
Thanks
Re: Menu attributes
You can call it in a page template using page_attr, {page_attr key="extra1"}
Or in a Navigator template, $node->extra1
If you're using it in a Navigator template, you need to make sure you aren't using loadprops=0 when you call it.
Or in a Navigator template, $node->extra1
If you're using it in a Navigator template, you need to make sure you aren't using loadprops=0 when you call it.
Not getting the answer you need? CMSMS support options
Re: Menu attributes
Hi Thanks for info.
Can these links go anywhere in the template or in a certain place?
Can these links go anywhere in the template or in a certain place?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Menu attributes
the {$node->extra1} data is only available in Navigator templates.
{page_attr} is usable everywhere. it's a standard plugin. There is help available for it in Extensions >> tags.
{page_attr} is usable everywhere. it's a standard plugin. There is help available for it in Extensions >> tags.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Menu attributes
EDIT: noticed too late DIGI3 already mentioned this.
Additionally: read the help of the Navigator module. Is has a parameter loadprops.
Additionally: read the help of the Navigator module. Is has a parameter loadprops.
You wouldn't be the first user desperately looking for the extra1 attribute to eventually find out this loadprops parameter is set to false in the {Navigator...} tag.(optional) loadprops="" - Use this parameter when NOT using advanced properties in your navigator template. This will disable the loading of all of the content properties for each node (such as extra1, image, thumbnail, etc.). This will dramatically decrease the number of queries required to build a navigation, and increase memory requirements, but will remove the possibility for much more advanced displays
Re: Menu attributes
Hi Guys
This idiot needs a little more help.
Can you explain were the loadprops is set? I can not find it anywhere.
In the main template I have this set just the below the {$content}
{page_attr key="extra1"}
I have tried adding the loadprops in the template like so:
{Navigator template='bandb_topnav' number_of_levels='1' loadprops='true'}
Without loadprops it gives me the correct menu I am only showing level 1. The other levels are called on a page.
I have also tried this {Navigator loadprops="1"}
whatever I put in 1, 2, 0, true or false it completely messes up the menu.
So were the devil is the loadprops set????
There seems no way to edit the module Navigator.
Yours
Totally confused.
This idiot needs a little more help.
Can you explain were the loadprops is set? I can not find it anywhere.
In the main template I have this set just the below the {$content}
{page_attr key="extra1"}
I have tried adding the loadprops in the template like so:
{Navigator template='bandb_topnav' number_of_levels='1' loadprops='true'}
Without loadprops it gives me the correct menu I am only showing level 1. The other levels are called on a page.
I have also tried this {Navigator loadprops="1"}
whatever I put in 1, 2, 0, true or false it completely messes up the menu.
So were the devil is the loadprops set????
There seems no way to edit the module Navigator.
Yours
Totally confused.
Re: Menu attributes
Just don't use loadprops at all. All we were saying is that if it's there in your Navigator call, your Navigator template won't have access to the extra1 parameter.
page_attr has nothing to do with loadprops, it's a parameter for Navigator. It's explained in the Navigator help. {page_attr key=extra1} in a PAGE template will always load the extra1 field from the current page. More options are available in the tag help for page_attr.
page_attr has nothing to do with loadprops, it's a parameter for Navigator. It's explained in the Navigator help. {page_attr key=extra1} in a PAGE template will always load the extra1 field from the current page. More options are available in the tag help for page_attr.
Not getting the answer you need? CMSMS support options
Re: Menu attributes
TIP:
If you want to know what variables/properties are available, e.g. in a Navigator template, use the print_r function/modifier to display some useful information on the page (or in the page source):
Example with extra comments in the page source (html):
Example with extra comments on the page itself (note it leads to invalid html, but heh, it's for troubleshooting)
Another useful tag which you can use at the top of your (Navigator) template is {get_template_vars}
If you want to know what variables/properties are available, e.g. in a Navigator template, use the print_r function/modifier to display some useful information on the page (or in the page source):
Example with extra comments in the page source (html):
Code: Select all
...
<ul>
{foreach $nodes as $node}
<!-- {$node|print_r} -->
{if $node->type == 'sectionheader'}
...
Code: Select all
...
<ul>
{foreach $nodes as $node}
<pre>{$node|print_r}</pre>
{if $node->type == 'sectionheader'}
...
Re: Menu attributes
I have removed all my references to loadprops but it still doesn't show the extra1 attribute.
I do have the correct code in the template.
I have also checked the page source just in case it was hidden in someway.
What I am trying to do is show the extra1 below the menu title not on the page This is part of the menu on the page just to show what I am trying to do.
I do have the correct code in the template.
I have also checked the page source just in case it was hidden in someway.
What I am trying to do is show the extra1 below the menu title not on the page This is part of the menu on the page just to show what I am trying to do.
Re: Menu attributes
Show us your Navigator template which contains the {$node->extra1} tag, and the {Navigator} call you're using to load it.
Not getting the answer you need? CMSMS support options
Re: Menu attributes
To be sure:
Adding an value to the Extra Page Attribute 1 field of a specific page: Snippet of output of {get_template_vars} at the top of the used Navigator template. {Navigator...} tag WITHOUT loadprops parameter
Adding an value to the Extra Page Attribute 1 field of a specific page: Snippet of output of {get_template_vars} at the top of the used Navigator template. {Navigator...} tag WITHOUT loadprops parameter
Re: Menu attributes
I don't have this {$node->extra1} in the nav template?
I have this in the main template {page_attr key="extra1"}
Do I need both?
This is the nav call in the main template which gives me level I only.
{Navigator template='bandb_topnav' number_of_levels='1'}
This is the call in the page
<div id="articles">{Navigator start_level=2 collapse=1}</div>
The id gives me css for the background.
The text in the page extra1 attribute is correct.
This is the nav template code straight out the box.
{strip}
{* Top Menu *}
{* drilldown for mobile, dropdown for tablet & above *}
{* see Zurb Foundation docs for other options *}
{function name=topnav}
{if $depth==0}
<ul class="vertical medium-horizontal menu" data-responsive-menu="drilldown medium-dropdown">
{else}
<ul class="menu">
{/if}
{foreach $data as $node}
{* setup classes for the anchor and list item *}
{assign var='liclass' value='menudepth'|cat:$depth}
{assign var='aclass' value=''}
{* the first child gets a special class *}
{if $node@first && $node@total > 1}{assign var='liclass' value=$liclass|cat:' first_child'}{/if}
{* the last child gets a special class *}
{if $node@last && $node@total > 1}{assign var='liclass' value=$liclass|cat:' last_child'}{/if}
{if $node->current}
{* this is the current page *}
{assign var='liclass' value=$liclass|cat:' menuactive'}
{assign var='aclass' value=$aclass|cat:' menuactive'}
{/if}
{if $node->parent}
{* this is a parent of the current page *}
{assign var='liclass' value=$liclass|cat:' menuactive menuparent'}
{assign var='aclass' value=$aclass|cat:' menuactive menuparent'}
{/if}
{if $node->children_exist}
{assign var='liclass' value=$liclass|cat:' parent'}
{assign var='aclass' value=$aclass|cat:' parent'}
{/if}
{* build the menu item node *}
{if $node->type == 'sectionheader'}
<li class='sectionheader {$liclass}'><a href="#" onclick="event.preventDefault();"><span>{$node->menutext}</span></a>
{if isset($node->children)}
{topnav data=$node->children depth=$depth+1}
{/if}
</li>
{else if $node->type == 'separator'}
<li class='separator {$liclass}'><hr class='separator'/></li>
{else}
{* regular item *}
<li class="{$liclass}">
<a class="{$aclass}" href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}><span>{$node->menutext}</span></a>
{if isset($node->children)}
{topnav data=$node->children depth=$depth+1}
{/if}
</li>
{/if}
{/foreach}
</ul>
{/function}
{if isset($nodes)}
{topnav data=$nodes depth=0}
{/if}
{/strip}
I have this in the main template {page_attr key="extra1"}
Do I need both?
This is the nav call in the main template which gives me level I only.
{Navigator template='bandb_topnav' number_of_levels='1'}
This is the call in the page
<div id="articles">{Navigator start_level=2 collapse=1}</div>
The id gives me css for the background.
The text in the page extra1 attribute is correct.
This is the nav template code straight out the box.
{strip}
{* Top Menu *}
{* drilldown for mobile, dropdown for tablet & above *}
{* see Zurb Foundation docs for other options *}
{function name=topnav}
{if $depth==0}
<ul class="vertical medium-horizontal menu" data-responsive-menu="drilldown medium-dropdown">
{else}
<ul class="menu">
{/if}
{foreach $data as $node}
{* setup classes for the anchor and list item *}
{assign var='liclass' value='menudepth'|cat:$depth}
{assign var='aclass' value=''}
{* the first child gets a special class *}
{if $node@first && $node@total > 1}{assign var='liclass' value=$liclass|cat:' first_child'}{/if}
{* the last child gets a special class *}
{if $node@last && $node@total > 1}{assign var='liclass' value=$liclass|cat:' last_child'}{/if}
{if $node->current}
{* this is the current page *}
{assign var='liclass' value=$liclass|cat:' menuactive'}
{assign var='aclass' value=$aclass|cat:' menuactive'}
{/if}
{if $node->parent}
{* this is a parent of the current page *}
{assign var='liclass' value=$liclass|cat:' menuactive menuparent'}
{assign var='aclass' value=$aclass|cat:' menuactive menuparent'}
{/if}
{if $node->children_exist}
{assign var='liclass' value=$liclass|cat:' parent'}
{assign var='aclass' value=$aclass|cat:' parent'}
{/if}
{* build the menu item node *}
{if $node->type == 'sectionheader'}
<li class='sectionheader {$liclass}'><a href="#" onclick="event.preventDefault();"><span>{$node->menutext}</span></a>
{if isset($node->children)}
{topnav data=$node->children depth=$depth+1}
{/if}
</li>
{else if $node->type == 'separator'}
<li class='separator {$liclass}'><hr class='separator'/></li>
{else}
{* regular item *}
<li class="{$liclass}">
<a class="{$aclass}" href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}><span>{$node->menutext}</span></a>
{if isset($node->children)}
{topnav data=$node->children depth=$depth+1}
{/if}
</li>
{/if}
{/foreach}
</ul>
{/function}
{if isset($nodes)}
{topnav data=$nodes depth=0}
{/if}
{/strip}
Re: Menu attributes
Page_attr with no page defined will output the extra1 of the current page, wherever you place the tag.
If you want to output it for each page in your navigation, you need to use node->extra1 in the appropriate place of your navigator template.
If you want to output it for each page in your navigation, you need to use node->extra1 in the appropriate place of your navigator template.
Not getting the answer you need? CMSMS support options
Re: Menu attributes
Hi
I now have the attribute showing but this was done by going back to using the menu call. {menu start_level='2' collapse='1' } and commenting out two bits of code in the template BandB_topnav i.e.
{* the first child gets a special class
{if $node@first && $node@total > 1}{assign var='liclass' value=$liclass|cat:' first_child'}{/if}
*}
{* the last child gets a special class
{if $node@last && $node@total > 1}{assign var='liclass' value=$liclass|cat:' last_child'}{/if}
*}
I have failed to find away to use Navigator.
I now just need to short ouit how to add css to the exra1 attribute.
Thanks fore all your help.
I now have the attribute showing but this was done by going back to using the menu call. {menu start_level='2' collapse='1' } and commenting out two bits of code in the template BandB_topnav i.e.
{* the first child gets a special class
{if $node@first && $node@total > 1}{assign var='liclass' value=$liclass|cat:' first_child'}{/if}
*}
{* the last child gets a special class
{if $node@last && $node@total > 1}{assign var='liclass' value=$liclass|cat:' last_child'}{/if}
*}
I have failed to find away to use Navigator.
I now just need to short ouit how to add css to the exra1 attribute.
Thanks fore all your help.