I would like to dynamically display different values for each page. For this to work, I would like to ‘filterby’ pages which contain the same string as a given variable. I would like to do something like this:
The callback that you pass to the filter method has to return a boolean value for each element of the collection that determines whether it should be in the result or not.
An example of the structure of the site is this: /genre/magazine-title/issue-title/issue.txt
Every issue has a year value.
I now want to create pages to list all issues of all magazines across all genres that have a specific ‘year’ value. For example to list all issues that have “1988” as year value. Every page has the chosenyear value of the year that I want to be listed.
Maybe I’m thinking way to complicated and there is a much easier solution than what I’m thinking of?
If I get this right, the problem is not the filter, but filtering the right collection of pages. The issues you want to filter seem to be more deeply nested than $pages->find('magazines')->children()?
Yeah, I’m using grandChildren(). And everything works fine if I manually input the year instead of “$chosenyear”. So I’m just looking how to implement the variable in there.