Page 1 of 1

menu issue with inactive subpages

Posted: Thu Mar 06, 2008 8:24 pm
by waynes01
Hi, new user of cmsms and first time post. First like to say it is a great product which I have started to use for smaller sites. I have a small menu issue which I was hoping someone could help with. If a subpage is marked inactive (but not excluded from menu) and I use this {if $node->haschildren}, it appears that it still will indicate it has children but it doesn't actually and so the menu gets screwed up. Has anyne experienced this issue? I can't find a command to check if it has active/inactive children......

Re: menu issue with inactive subpages

Posted: Tue Mar 11, 2008 4:12 pm
by Pierre M.
Welcome,

please have a look at http://wiki.cmsmadesimple.org/index.php ... plate_vars
May be it shows a way to know the (in)active status ?

Pierre M.

Re: menu issue with inactive subpages

Posted: Wed Mar 19, 2008 9:05 am
by wayne
Thanks Pierre, finally got round to trying to fix it. Problem I have is that I need to detemine if the page has been deactivated but that is not part of the $nodelist object. I can see that there is a variable set called "mActive" in the template vars but I have no idea how to access it......

*RECURSION* [content] => Array ( [15] => content Object ( [mId] => 15 [mName] => Home [mType] => content [mOwner] => 1 [mProperties] => contentproperties Object ( [mPropertyNames] => Array ( [0] => content_en ) [mPropertyTypes] => Array ( [content_en] => string ) [mPropertyValues] => Array ( [content_en] => ) [mAllowedPropertyNames] => Array ( [0] => content_en ) ) [mPropertiesLoaded] => [mParentId] => -1 [mOldParentId] => -1 [mTemplateId] => 20 [mItemOrder] => 1 [mOldItemOrder] => 1 [mMetadata] => [mTitleAttribute] => Home Page, shortcut key=1 [mAccessKey] => 1 [mTabIndex] => [mHierarchy] => 00001 [mIdHierarchy] => 15 [mHierarchyPath] => home [mMenuText] => Home [mActive] => 1  

How do I access that in the menu module? How could I determine if a page is inactive? 

Re: menu issue with inactive subpages

Posted: Wed Mar 19, 2008 11:21 am
by wayne
Ok, I just realised I am barking up the wrong tree. Doesn't matter if I can access the "active" variable because I am going to have the same issue. I will try to explain my problem and maybe someone can see where I am going wrong. I am using the code below to style a horizontal menu with dropdowns but the problem is the keyword hasChildren still indicates a node has children even if the children are inactive. So problem is on the next loop it doesn't find the child but the next parent node bt based on the code it will set it as a child. So what I need to do is either peek into the next node to determine what type it is or something like that. Any help will be appreciated:

{if $count > 0}


{foreach from=$nodelist item=node}
        {* close off any previous levels if node is less than previous *}
      {if $node->index > 0 and $node->depth prevdepth}
      {repeat string="" times=$node->prevdepth-$node->depth}
   {/if}

   {if $node->haschildren == true}
       url}" {if $node->accesskey != ''}accesskey="{$node->accesskey}" {/if}{if $node->tabindex != ''}tabindex="{$node->tabindex}" {/if}{if $node->titleattribute != ''}title="{$node->titleattribute}"{/if}{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}

    {* close off ending tag if node depth haschildren}
 
{else}
 
{/if}
{/foreach}
{* close of any remaining tags from last deep menu *}
{repeat string="" times=$node->depth-1}

{/if}

that will result in:


Page 1
Page 2
     
             Page 2.1
             Page 2.2
       

Page 3


That's assuming all pages active. If I now make the sub-pages (2.1 & 2.2) inactive I get this:

ul id="p7PMnav">
Page 1
Page 2
     
             Page 3
       



Hope this makes sense.....