Page 1 of 1

[SOLVED] SMARTY: if child of page X

Posted: Sat Apr 19, 2014 9:26 am
by frankmanl
All children of page X should use a GCB. In my template I want this logic:

Code: Select all

if page == child of page X
  GCB
endif
But how can I do this using SMARTY?
If I can't use SMARTY for this, is there another way?

I now use SMARTY's if statement and a prefix (in the page alias) to identify these pages:

Code: Select all

if $page_alias|strstr:"prefix"
  GCB
endif
but I look for another method, since the prefix also shows up in the URL.

Frank

Re: SMARTY: if child of page X

Posted: Sat Apr 19, 2014 9:30 am
by Jo Morg
You'll need to use CGSimpleSmarty and

Code: Select all

{cgsimple::get_root_alias()}

Re: SMARTY: if child of page X

Posted: Sat Apr 19, 2014 12:34 pm
by frankmanl
Thanks Jo Morg, in my case what I need turns out to be
{cgsimple::get_parent_alias()}.

Code: Select all

if {cgsimple::get_parent_alias()} == 'X'
  GCB
endif

Re: [SOLVED] SMARTY: if child of page X

Posted: Sat Apr 19, 2014 12:40 pm
by Jo Morg
Duh! But of course! lol!