Page 1 of 1

show content block only if not child of certain parent-page

Posted: Tue May 17, 2011 12:07 pm
by admsh
I'm trying to NOT show a content block on pages that are child-pages of a certain category on my site.

I know how to hide a content block if the page alias is this or that, but how do I change the code to not show the content block on any page that is a child-page of a certain category?

This is the code I'm using now:

Code: Select all

{if $page_alias != about}
{content block="sidebar"}
{if}
Now, I want to change this code to also effect all child pages of "about". I dont' want to manually list those pages' aliases... because editors may create new pages there.

Anyone knows of a way?

Re: show content block only if not child of certain parent-p

Posted: Tue May 17, 2011 1:39 pm
by RonnyK
Check CGSimpleSmarty, there is a call in there to check for the parentpage, and also for the rootpage. With either one, you can do your similar call, depending on the position of the parent you want to check.

Ronny

Re: show content block only if not child of certain parent-p

Posted: Thu Jun 09, 2011 10:14 am
by Mantlet
Like Ronny says, use CGSimpleSmarty. You'll need something like this:

Code: Select all

{if $cgsimple->get_parent_alias() != about}
{content block="sidebar"}
{/if}
Instead of get_parent_alias you can also use get_root_alias to go to the top page of that menu tree.

Good luck!!