Jump to content

How to create a pageArray from id's which i get via $pages->find


iNoize
 Share

Recommended Posts

Hello, 

i have an call where i select my pages with different parameters. 

$kundenliste = $pages->find("template=referenz, limit=8, images.count>0, unternehmen.count>=1, sort=random");
						

unternehmen is an Page tv where I associate the pages to the project. 

so i get an array of ID's 
 

foreach ($kundenliste as $kunden) {
echo $kunden->unternehmen."<br>";
}

how i can create a new pageArray so that i can loop the id's and get the title , images , headline values from the unternehmen ?? 

because 

foreach ($kundenliste as $kunden) {
echo $kunden->unternehmen->images->first()->url;
}

dont really works for me. 

Link to comment
Share on other sites

There's no "creation of a new page array", because $kunden->unternehmen is already the pagearray. It's just converted in a list of id's for stringified output. You can directly loop over the list like so:

foreach ($kundenliste as $kunden) {
  foreach($kunden->unternehmen as $unternehmen){
    echo $unternehmen->title;
  }
}
  • Like 1
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...