Jump to content

could not get sub-page


adrianmak
 Share

Recommended Posts

 I have the following page structure

Home
   +----page1 (id=1)
   +----page2 (id=2)
      +----page2.1(id=3)
      +----page2.2(id=4)
      +----page2.3(id=5)
   +----page3(id=6)
   +----page3(id=7)

I used following code to get a page url

$pageurl[$page->get("id=1")->id] = $page->get("id=1")->url;

I could get those url from id 1, 2, 6 and 7.
However, I could not get any values from sub-pages of id=2, i.e. 3, 4,5

Isn't there need to supply other  paramters to get a sub-page if another page?

Link to comment
Share on other sites

I really don't understand what you are trying to do, but does it help if you use $pages instead of $page?

I am guessing those ids are just examples? Also, you don't need "id=1" just: $pages->get(1) works.

$pages->get() - returns one page from throughout the page tree

$pages->find() - returns all matched pages from throughout the page tree

$page->get() - returns the first matching child of $page although I think $page->child() makes more sense in this case

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