Simoroshka
Simoroshka

Reputation: 349

Concrete5: get pages in the root of the website

I want to display all website pages on a single page in a tree structure (sort of like the existing sitemap). I can get a page by its ID, I can get children of a page, but how do I find pages that are in the root and do not have a parent? In other words, how do I get the first level on the tree?

EDIT: I found out that home page has ID = 1, and dashboard ID = 2. I hope it is like this in every installation of Concrete5...

Upvotes: 0

Views: 275

Answers (2)

Simoroshka
Simoroshka

Reputation: 349

OK, I found the answer in the code. This is how you get home page:

$home = Page::getByID(HOME_CID, 'RECENT');

And this is how you get the children:

$children = $home->getCollectionChildren();

Upvotes: 1

Văn Tuấn Phạm
Văn Tuấn Phạm

Reputation: 659

you can use

 <?php echo View::url('/'); ?>
 <?php echo View::url('/some-page'); ?>

Upvotes: 0

Related Questions