• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Menu attributes
PostPosted: Tue Apr 16, 2019 12:56 pm 
Offline
Forum Members
Forum Members

Joined: Tue Aug 14, 2018 6:35 pm
Posts: 12
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


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Tue Apr 16, 2019 2:10 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 760
Location: Victoria, BC
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.

_________________
Not getting the answer you need? CMSMS support options


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Tue Apr 16, 2019 2:33 pm 
Offline
Forum Members
Forum Members

Joined: Tue Aug 14, 2018 6:35 pm
Posts: 12
Hi Thanks for info.
Can these links go anywhere in the template or in a certain place?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Tue Apr 16, 2019 4:17 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8099
Location: Fernie British Columbia, Canada
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.

_________________
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.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Wed Apr 17, 2019 6:58 am 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3091
Location: The Netherlands
EDIT: noticed too late DIGI3 already mentioned this.

Additionally: read the help of the Navigator module. Is has a parameter loadprops.

Quote:
(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


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.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Wed Apr 17, 2019 2:53 pm 
Offline
Forum Members
Forum Members

Joined: Tue Aug 14, 2018 6:35 pm
Posts: 12
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.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Wed Apr 17, 2019 3:00 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 760
Location: Victoria, BC
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.

_________________
Not getting the answer you need? CMSMS support options


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Wed Apr 17, 2019 3:10 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3091
Location: The Netherlands
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):
Code:
...
<ul>
  {foreach $nodes as $node}
     <!-- {$node|print_r} -->
    {if $node->type == 'sectionheader'}
...


Example with extra comments on the page itself (note it leads to invalid html, but heh, it's for troubleshooting)
Code:
...
<ul>
  {foreach $nodes as $node}
     <pre>{$node|print_r}</pre>
    {if $node->type == 'sectionheader'}
...


Another useful tag which you can use at the top of your (Navigator) template is {get_template_vars}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Wed Apr 17, 2019 3:20 pm 
Offline
Forum Members
Forum Members

Joined: Tue Aug 14, 2018 6:35 pm
Posts: 12
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
Attachment:
menu.jpg
menu.jpg [ 76.84 KiB | Viewed 265 times ]


This is part of the menu on the page just to show what I am trying to do.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Wed Apr 17, 2019 3:21 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 760
Location: Victoria, BC
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


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Wed Apr 17, 2019 3:34 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3091
Location: The Netherlands
To be sure:

Adding an value to the Extra Page Attribute 1 field of a specific page:
Attachment:
2019-04-17 17_26_36-Content Manager - CMSMS 2.2.9.1.png
2019-04-17 17_26_36-Content Manager - CMSMS 2.2.9.1.png [ 18.03 KiB | Viewed 264 times ]


Snippet of output of {get_template_vars} at the top of the used Navigator template. {Navigator...} tag WITHOUT loadprops parameter
Attachment:
2019-04-17 17_27_25-Home - CMSMS 2.2.9.1.png
2019-04-17 17_27_25-Home - CMSMS 2.2.9.1.png [ 20.18 KiB | Viewed 264 times ]


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Wed Apr 17, 2019 3:55 pm 
Offline
Forum Members
Forum Members

Joined: Tue Aug 14, 2018 6:35 pm
Posts: 12
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}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Wed Apr 17, 2019 5:08 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 760
Location: Victoria, BC
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.

_________________
Not getting the answer you need? CMSMS support options


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu attributes
PostPosted: Fri Apr 19, 2019 2:47 pm 
Offline
Forum Members
Forum Members

Joined: Tue Aug 14, 2018 6:35 pm
Posts: 12
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.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: googlebot


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting