Jump to content

$pages->find but only find pages with no children


picarica
 Share

Recommended Posts

so i want to $pages->find find pages only that dont have children i didnt see any options for this so i tried this

$kate = $pages->find("template=hry_home");
foreach ($kate as $bruh) {
    if($bruh->hasChildren()) {
            $kate->remove($bruh);
    }
}

this works incredibly good but i need it for pagination so i still need to limit it and thats where i got stuck simply

$kat = $pages->find("$kate ,limit=5"); 

doesnt work, how do you work around this problem?

every page has the same template, so i cannot use just different selector in find command are there any other quirsk i could use ?

Link to comment
Share on other sites

15 minutes ago, Zeka said:

Hi @picarica

Have you tried something like

$pages->find('template=hry_home, children.count=0');

or 

$pages->find('template=hry_home')->not('children.count=0');

no i wasnt aware of -> not() functinon this works fine i found out one workaround by myself i checked if field which as every page isnt empty but this is very good solution thanks

$kat = $pages->find("subor_hry>1, $limiter");

 

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...