Jump to content

Interweave sections on single page website with text snippets


opalepatrick
 Share

Recommended Posts

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 ?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...