[SOLVED] customcontent and sectionheaders

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
jan_hut
Forum Members
Forum Members
Posts: 60
Joined: Sat Jul 01, 2006 1:48 pm

[SOLVED] customcontent and sectionheaders

Post 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?
Last edited by jan_hut on Sun Nov 22, 2009 12:29 pm, edited 1 time in total.
jan_hut
Forum Members
Forum Members
Posts: 60
Joined: Sat Jul 01, 2006 1:48 pm

Re: customcontent and sectionheaders

Post 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
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: [SOLVED] customcontent and sectionheaders

Post 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.
jan_hut
Forum Members
Forum Members
Posts: 60
Joined: Sat Jul 01, 2006 1:48 pm

Re: [SOLVED] customcontent and sectionheaders

Post 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.
Post Reply

Return to “Modules/Add-Ons”