So what I have is a parent template. With various access to a feature. It will show or hide certain elements of the site based on permission. Here’s the issue. My current logic won’t work with children. Because if the ending template parent doesn’t have permission the children shouldn’t be able to either. for instance.
localhost:8888/faq/more/something/else
1 = checked
0 = not checked
if faq = 0
more = 1
something = 1
else=1
I run this check if $parent() == $site()
So what I want to do is escape all the way back until I get to the page right before $site() if at all along the way I hit a 0 I want to go into an else statement. But I want it to keep counting until it hits the page right before site which is FAQ. This way I can check all the way down a geneology to make sure the Parent closest to $site() has checked box. But I don’t want to check the $site->() template. Hope that makes sense.
<?php if ($page->accessToResourceCenter() == '1'): ?>
<?php snippet('sidemenu') ?>
<? else : ?>
<?if($page->parent()->url() == $site->url()) : ?>
<? else :?>
<?php snippet('sidemenu') ?>
<?endif?>
<?php endif ?>