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

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
admsh
Forum Members
Forum Members
Posts: 93
Joined: Tue Aug 19, 2008 6:30 pm

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

Post 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?
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

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

Post 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
Mantlet
Forum Members
Forum Members
Posts: 114
Joined: Fri Apr 28, 2006 9:42 am

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

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

Return to “Layout and Design (CSS & HTML)”