Jump to content

Recommended Posts

Posted

Well, if you want to do literally that

$page->parent->children

but this is better  :)

$page->siblings

or, to exclude the current page

$page->siblings("id!=$page")

or

$page->siblings->remove($page)

  • Like 2
Posted

The beginner profile template files (like the one I linked to) have very well commented examples of these kind of things, have a good look at them.

You'll get the hang of it in no time, you'll see ;)

Posted

Yeah, I am slowly getting there. I did notice after doing some more research into the basic install that: "// top navigation consists of homepage and its visible children".

However, what I was trying to snag were the children of a child. 

For example:

Home

  - Fish

      - Bass

      - Brim

      - Carp

  - Site Map

  - About

In the above example, I was trying to pull the children of  "Fish". Perhaps I set this up wrong as I couldnt figure out a way to get "Fish" to be top level like Home.

Posted

In that case, you just have to get the fish page and then get it's children $pages->get("/fish/")->children

Or, if you're planning to use that page again later in the code:

$fish = $pages->get("/fish/");

$fishChildren = $fish->children;

foreach ($fishChildren as $item) {
    ...
}
Posted

$page->children is an array, you can't echo it directly:

foreach($page->children as $child) {
    echo $child->title;
}

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