[SOLVED] SMARTY: if child of page X

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
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

[SOLVED] SMARTY: if child of page X

Post 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
Last edited by frankmanl on Sat Apr 19, 2014 12:35 pm, edited 1 time in total.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1921
Joined: Mon Jan 29, 2007 4:47 pm

Re: SMARTY: if child of page X

Post by Jo Morg »

You'll need to use CGSimpleSmarty and

Code: Select all

{cgsimple::get_root_alias()}
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

Re: SMARTY: if child of page X

Post 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
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1921
Joined: Mon Jan 29, 2007 4:47 pm

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

Post by Jo Morg »

Duh! But of course! lol!
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Post Reply

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