opalepatrick Posted July 7, 2015 Posted July 7, 2015 I am looking for some help in getting my head around how to do the following. I have a single page site that works great with some handy code (thanks Soma ;-) ) foreach($page->children("has_parent!=2,id!=2|7|27,status<".Page::statusTrash.",include=hidden") as $p){ //if quotes.quote not rendered before in main foreach loop, print next in order echo $p->render(); } This renders out pages as sections. What I want to do now however is pull a quote from a page that has the quotes and attributions in a repeater field and render them after each main section. And, to make it do my head in more, I want just enough to match the available sections, as well as pull them in the order that they appear in the quote page! I am no doubt making this more difficult, so any help in putting my head right would be appreciated. I am thinking I should put a counter $i before the loop then select each repeater quote by id equals $i ?
opalepatrick Posted July 8, 2015 Author Posted July 8, 2015 Sorted this with the help of LostKobrokai on another thread by looping through foreach($page->children("has_parent!=2,id!=2|7|27,status<".Page::statusTrash.",include=hidden") as $p){ $quote = $pages->get(1034)->quotes->eq($i); // loop through $quote to get repeater fields and print here echo $p->render(); } And getting the required fields from the repeater
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