felic Posted February 4, 2016 Share Posted February 4, 2016 Hi everyone! I have parent page (and template) dates with numerous child pages for single event dates. Beside the content related fields each child page contains two fields which are added (for now) just for sorting purposes (item_sorting_month, item_sorting_year). Getting those child pages and output them in a straight foreach loop is simple: $current_date = date("d.m.Y"); $items = $page->children("item_date>=$current_date, sort=item_sorting_year, sort=item_sorting_month"); foreach($items as $item) { .. } This gives me a well sorted flat output like this: - item - item But what i like to achieve (and doesn't get it right) is this: - Year -- Month --- item -- Month --- item - Year -- Month --- item -- Month --- item Additionally i like to establish a anchor link navigation to all available month, e.g. Feb.2016, Jul.2016, Jan.2017 a.s.o. because the list might be a large one. I spent more than a day with several trail/error (separate $page->find(...), nested foreach loops etc.) at least. But all leads to nothing :-/ Maybe some of you have some hints where to look at, e.g. how to achieve this. I hope my description is precise enough. Otherwise, please don't hesitate to ask. Cheers and thx in advance Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted February 7, 2016 Share Posted February 7, 2016 (edited) I guess you are trying to build something like this. It is an example blog profile for PW built by ryan. Here is the source code for that page - a place to copy-and-paste from or get inspired with. If it does not help, feel free to write back. By the way, you don't need those extra fields just for sorting purpose as you will see in the code provided. One date field holds all the data needed to make that tree. Edited February 7, 2016 by Ivan Gretsky 1 Link to comment Share on other sites More sharing options...
felic Posted February 7, 2016 Author Share Posted February 7, 2016 Ivan, thanks for the link(s)! Yes, ryan's blog/archives templates looks promising how to get my desired render structure . I'll get my hands on the code tomorrow and hope i am able to adapt this for my needs. 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