Jump to content

Add some pages into PageArray (problems)


Recommended Posts

Hello together,
this might be a newbie questions, but I got some problems with a PageArray and don’t know how to go on. 

My goal is give out the parent.name of a page that was found earlier and was put into a PageArray.

My found pages:

$matches = $pages->find($selector);

Some of the pages that are present in $matches need to be put into a new array $the_page_array. 
I do this via a this foreach loop, but I do not 

foreach($matches as $match) {
    if ($match==condition_blah_blah) {
        $the_page_array[]=$match; // if condition true, then add pages to new array

From here, I can print out some stuff, e.g. my parent.name of the $single_page:

foreach($the_page_array as $single_page) { 
    echo „<a target='_blank' href='$single_page->url'>$single_page->title</a> ";
        echo $single_page>parent->name;

So far so good. But from here I want to find some pages in the PageArray that have a given parent.name:

$filtered_matches = $the_page_array->find(„parent.name=blahblahblah");

But this gives out an error:
Error:  Call to a member function find() on array 

In fact, I can use any PageArray function like 
$filtered_matches = $plz_page->getTotal();
and I get the same error.

I believe this has something to do that $the_page_array is an PageArray (or not)?

Any help or hint would be wonderful.
Thanks in advance 

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

  • Create New...