Jump to content

pagearray with pages and their children in order of appearance in the pagetree


Recommended Posts

Posted

This might be a very basic question, don't know what's the easiest solution though…

Let's say I have some pagetree like that:

beverages
> whiskey
> > Jameson
> > Ardberg
> beer
> > Heineken
> > Leffe
sweets
> cake
> > cheesecake
> > chocolate
> ice cream
> > stracciatella
> > raspberry

I want an array of all these pages in order of appearance in the page tree.

I tried:

$homepage = $pages->get('/');
$items = $homepage->descendants("template=menu");

But when I loop through it

foreach ($items as $item) {
	echo $item->title;
}

it first shows level 1, then level 2, then level 3

like this:
beverages, sweets, whiskey, beer, cake, ice cream, Jameson, Ardberg, Heineken, Leffe, cheesecake, chocolate, straciatelly, raspberry

Thanks for help! 

 

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
  • Recently Browsing   0 members

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