Page 1 of 1
[SOLVED] Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 12:55 am
by neil-cmsms
I'm using v1.9.1 and when debugging my menus found that the "$node->target" value is never getting set to the value I entered in my page. In my {$node|print_r} output during the NCleanBlue menu loop it's always listed but never set to anything:
stdClass Object ( [id] => 22 [pagetitle] => Menu Title [url] =>
http://blah.blah.com/home/url [accesskey] => [type] => content [tabindex] => [titleattribute] => [modified] => 1290729736 [created] => 1290725553 [hierarchy] => 4 [depth] => 1 [prevdepth] => 2 [children_exist] => 1 [haschildren] => 1 [menutext] => Menu Text [raw_menutext] => Increase Revenue
[target] => [index] => 15 [alias] => increase-revenue [parent] => [current] => ) 1
Am I missing some setup/configuration?
Thanks,
Neil
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 1:47 am
by calguy1000
Have you set the target when editing content? instead of 'none' ?
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 3:11 am
by neil-cmsms
calguy1000 wrote:
Have you set the target when editing content? instead of 'none' ?
Yes, for some some pages and not others. I've set them to the _blank selection where not None.
Thanks,
Neil
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 3:43 am
by neil-cmsms
calguy1000 wrote:
Have you set the target when editing content? instead of 'none' ?
FYI I tried this with a v1.7 installation and it works fine.
Thanks, Neil
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 3:53 am
by Dr.CSS
Does the menu template have the node target call in it?...
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 5:17 am
by neil-cmsms
Dr.CSS wrote:
Does the menu template have the node target call in it?...
Not 100% sure what you mean - it the usual node loop and the $node->target is being tested before being inserted - here's the menu template (look from the bottom, just above the {/foreach}):
Code: Select all
{* CSS classes used in this template:
#menuwrapper - The id for the <div> that the menu is wrapped in. Sets the width, background etc. for the menu.
#primary-nav - The id for the <ul>
.menuparent - The class for each <li> that has children.
.menuactive - The class for each <li> that is active or is a parent (on any level) of a child that is active. *}
{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 $count > 0}
<div id="menuwrapper">
<ul id="primary-nav">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string='<ul class="unli">' times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string='</li><li class="separator once" style="list-style-type: none;"> </li></ul>' times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->parent == true or $node->current == true}
{assign var='classes' value='menuactive'}
{if $node->parent == true}
{assign var='classes' value='menuactive menuparent'}
{/if}
{if $node->children_exist == true and $node->depth < $number_of_levels}
{assign var='classes' value=$classes|cat:' parent'}
{/if}
{if $node->type == 'sectionheader'}
<li class="{$classes} sectionheader"><a class="{$classes}"><span class="sectionheader">{$node->menutext}</span></a>
{else}
<li class="{$classes}"><a class="{$classes}"
{/if}
{elseif $node->type == 'sectionheader' and $node->haschildren == true}
<li class="sectionheader">
<a >
{if $node->depth>1}
<span style="float:right;display:inline-block">»</span>
{/if}
<span class="sectionheader">{$node->menutext}</span>
</a>
{elseif $node->type == 'sectionheader'}
<li class="sectionheader"><a ><span class="sectionheader">{$node->menutext}</span></a>
{elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;"> <hr class="menu_separator" />
{elseif $node->children_exist == true and $node->depth < $number_of_levels and $node->type != 'sectionheader' and $node->type != 'separator'}
<li class="menuparent"><a class="menuparent"
{else}
<li>
<a
{/if}
{if $node->type != 'sectionheader' and $node->type != 'separator'}
{if $node->target} target="{$node->target}" {/if}
href="{$node->url}"><span>{$node->menutext}</span></a>
{/if}
{* $node|print_r *}
{/foreach}
{repeat string='</li><li class="separator once" style="list-style-type: none;"> </li></ul>' times=$node->depth-1}
</li>
</ul>
<div class="clearb"></div>
</div>
{/if}
Is anyone able to get this to work with their 1.9.1 installation - it's simple to try.
Thanks,
Neil
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 5:50 am
by calguy1000
I just tested with a stock menumanager template, and the target attribute stuff worked fine.
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 5:35 pm
by neil-cmsms
calguy1000 wrote:
I just tested with a stock menumanager template, and the target attribute stuff worked fine.
OK, embarassment mode set to ON
When I copied the reference NCBlueClean theme I didn't notice that the template menu tag set loadprops=0 - never having used this before it didn't stand out. I just changed the name of the menu template being called.
I guess it's maybe not too clear which of the properties will not be loaded when this is set to zero - is there a list of what is or is not included? It was odd that there was still a node property called "target" rather than there being no property of that name - I incorrectly assumed it was proactively getting set to empty.
It's all working now, so I am happy.
Thank you for your assistance.
Neil
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 6:56 pm
by Dr.CSS
The Menu Manager Help will explain what it does...
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 7:23 pm
by neil-cmsms
Dr.CSS wrote:
The Menu Manager Help will explain what it does...
I looked there and it says:
(optional) loadprops="0" - Use this parameter when NOT using advanced properties in your menu manager template. This parameter will disable the loading of all content properties for each node (such as extra1, image, thumbnail, etc). This will dramatically decrease the number of queries required to build a menu, and increase memory requirements, but will remove the possibility for much more advanced menus
Clearly it's loading
some "properties" for it to work at all - the alias, url etc. It's still not obvious to me which of the fields there would be considered "advanced" - am I missing some naming convention or positioning of the input fields that would help me here? For example, I would not have considered "target" to be particularly advanced - it's just part of the url/alias construction.
Thanks, Neil
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 7:33 pm
by Dr.CSS
Anything you don't see in here is an 'advanced' property...
{if $count > 0}
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="" times=$node->depth-$node->prevdepth}
{elseif $node->depth prevdepth}
{repeat string="" times=$node->prevdepth-$node->depth}
{elseif $node->index > 0}
{/if}
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
url}">{$node->menutext}
{elseif $node->haschildren == true and $node->type != 'sectionheader' and $node->type != 'separator'}
url}">{$node->menutext}
{elseif $node->current == true}
{$node->menutext}
{elseif $node->type == 'sectionheader'}
{$node->menutext}
{elseif $node->type == 'separator'}
{else}
url}">{$node->menutext}
{/if}
{/foreach}
{repeat string="" times=$node->depth-1}
{/if}
Re: Bug in menu nodes - Missing target attribute, v1.9.1
Posted: Sat Nov 27, 2010 8:50 pm
by neil-cmsms
Thanks! - marking this thread as solved.