Jump to content

Recommended Posts

Posted

Hey,

I have a tournament page that requires teams competing in that tournament, this can be more then 2 it can be 100+ so I thought i get a page array but how do i use it in the template?

i tried:

foreach($page->teams as $team);
{
echo $team->title;
}

But then I'd only get the last team...

how do i get this right?

Posted

Assuming that $page->teams is a pageField, this is the correct way of doing it. Check again the settings from the field. Is it allowing multiple pages?

Posted

Assuming that $page->teams is a pageField, this is the correct way of doing it. Check again the settings from the field. Is it allowing multiple pages?

Yes, i am allowing that, when i echo the field i get

1014|1011|1441

...

Posted

You've got an extra semicolon after the foreach. Thus the loop is empty and echo gets executed only after the last iteration.

So you were doing the right thing basically, just take the semicolon away and you're good. :)

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
×
×
  • Create New...