[SOLVED] Bug in menu nodes - Missing target attribute, v1.9.1

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
neil-cmsms
Forum Members
Forum Members
Posts: 16
Joined: Sat Nov 06, 2010 11:14 pm

[SOLVED] Bug in menu nodes - Missing target attribute, v1.9.1

Post 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
Last edited by neil-cmsms on Sat Nov 27, 2010 8:50 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post by calguy1000 »

Have you set the target when editing content? instead of 'none' ?
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.
neil-cmsms
Forum Members
Forum Members
Posts: 16
Joined: Sat Nov 06, 2010 11:14 pm

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post 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
neil-cmsms
Forum Members
Forum Members
Posts: 16
Joined: Sat Nov 06, 2010 11:14 pm

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post by Dr.CSS »

Does the menu template have the node target call in it?...
neil-cmsms
Forum Members
Forum Members
Posts: 16
Joined: Sat Nov 06, 2010 11:14 pm

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post by calguy1000 »

I just tested with a stock menumanager template, and the target attribute stuff worked fine.
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.
neil-cmsms
Forum Members
Forum Members
Posts: 16
Joined: Sat Nov 06, 2010 11:14 pm

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post by Dr.CSS »

The Menu Manager Help will explain what it does...
neil-cmsms
Forum Members
Forum Members
Posts: 16
Joined: Sat Nov 06, 2010 11:14 pm

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post 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}
neil-cmsms
Forum Members
Forum Members
Posts: 16
Joined: Sat Nov 06, 2010 11:14 pm

Re: Bug in menu nodes - Missing target attribute, v1.9.1

Post by neil-cmsms »

Thanks! - marking this thread as solved.
Post Reply

Return to “CMSMS Core”