Page 1 of 1

[SOLVED] customcontent and sectionheaders

Posted: Sat Nov 21, 2009 1:06 pm
by jan_hut
I must be overlooking something but I just can't figure this one out. I used calguy's visual tutorial to hide certain menu-items based on FEU and Custom Content. So far so good.
I have used the following code:

Code: Select all

{if $ccuser->loggedin() && $ccuser->memberof('Bewoners')}
          {menu template='cssmenu_ulshadow.tpl' excludeprefix="public_}
{else}
{menu template='cssmenu_ulshadow.tpl' excludeprefix="private_}
{/if}
Now this works perfect, however when a user is not logged in or doesn't belong to this particular group the "Section Headers" are still visible. In this particular site visitors are not supposed to see any section headers at all so this could be done the ugly way.
I was thinking of adding this to the menu template:

Code: Select all

{elseif $node->type == 'sectionheader' and $node->haschildren == true and $ccuser->loggedin() && $ccuser->memberof('Bewoners')}
<li class="sectionheader"><span class="sectionheader">{$node->menutext}</span>
This obviously doesn't work. Does anyone have any idea how to get his thing working?

Re: customcontent and sectionheaders

Posted: Sun Nov 22, 2009 12:28 pm
by jan_hut
Got an ugly solution for this. Made a copy of the menu template and removed the following line:

Code: Select all

<span class="sectionheader">{$node->menutext}
then called the menu('s) in my template as follows:

Code: Select all

{if $ccuser->loggedin() && $ccuser->memberof('Bewoners')}
          {menu template='cssmenu_ulshadow.tpl' excludeprefix="public_}
{else}
{menu template='cssmenu_ulshadow_2.tpl' excludeprefix="private_}
{/if}

Ugly, but works

Re: [SOLVED] customcontent and sectionheaders

Posted: Sun Nov 22, 2009 3:43 pm
by jmcgin51
if the section headers aren't supposed to display at all, why not just uncheck the "show in menu" checkbox on the content editor page?  Seems a lot simpler than fooling with the menu.

Re: [SOLVED] customcontent and sectionheaders

Posted: Sun Nov 22, 2009 8:27 pm
by jan_hut
They are only to be shown to registered members, but not to visitors. Since the excludeprefix function in the menumanager only allows you to refer to aliases (and section headers do not have an alias) this can't be done. If you want logged in FE users to see section headers visitors will see them too, though you can hide any children the section headers have as long as they are real pages.