a-ok Posted May 15, 2018 Share Posted May 15, 2018 I have a RepeaterMatrix set up on a parent page and within each 'type' there's two specific fields... one is a CheckboxField and another is a PageField – the CheckboxField allows the user to hide this 'type' (or row) from the overview page and the pageField allows the user to select some categories that the 'type' is connected to. On the category pages I want it to run through the RepeaterMatrix from the parent page and only return the rows where the PageField matches the category. So within my loop of the RepeaterMatrix I have the following: if ($page->template->name == 'about-detail') { if (!$module->global_flexible_modules_about_category->has($page)) { continue; } } And on the overview page I want it to only return the rows where the CheckboxField isn't ticked (so not hidden): if ($page->template->name == 'about-overview') { if ($module->global_flexible_modules_hide == 1) { continue; } } Two things... 1. To get this to work (which it does) on the first example I had to add the ! to the check but I'm sure this is backwards (if the category contains the current page then continue) but if I remove the ! it returns all the rows except the ones with the page selected as a category... adding the ! resolves this but I'm confused as I think this is backwards? Same with the second example... shouldn't it be if the checkbox isn't ticked then continue (!= 1)? They both seem backwards even though they're working. 2. Is there a more efficient/better way to achieve this as perhaps filtering the query before the loop? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now