Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

[solved] Find out whether a page has a certain page / grandparent.


Reply


2 Posts   668 Views

Avatar
njprrogers

Community Member, 23 Posts

7 April 2011 at 4:30am

Hi,

I'm looking to show a different header and footer in my templates depending on whether the current page has a certain ancestor.

So if the url has

www.mysite.com/us/mycategory/mypage perform one action

else
if the url has

www.mysite.com/nz/mycategory/mysubcategory/mypage perform another action.

I want to show one header and footer for us and another for nz. The page could be a variable number of levels down the heirarchy. Is there anything in SilverStripe to do this?

Thanks,

Nick

Avatar
njprrogers

Community Member, 23 Posts

7 April 2011 at 4:56am

Solved:

               <% if InSection(nz) %>
                     <p>God Bless NZ!</p>
               <% end_if %>