Translations of this page?:
General
Getting & Giving Support
Administration
Design
- Tut. - Layouts and Themes
- Tut. - Navigation cookbook
- Tut. - How To section
Reference Material
Plugin Development
- Tut. - Writing a plugin
- Ref. - List of Events
- Ref. - Enabling cron jobs
- Ref. - PHPDoc
Core Development
- Ref. - PHPDoc
Press information
Wolf CMS books section
findById()
The findById() function allows you to retrieve a set of page objects using a page's id as the search term.1) This function works in the same way as the find() function; consult its entry for more discussion about how to use “findById” also.
Example
You can use the id of page to construct a basic menu of child pages. This can be helpful in cases where the slugs or location of a parent page might change (“4” is the id of the “articles” page in a default installation of Wolf):
<?php $children = $this->findById(4)->children(); ?> <ul> <?php foreach ($children as $child) : ?> <li><?php echo $child->link(); ?></li> <?php endforeach; ?> </ul>
1)
See the "id" documentation on how to find the ID of any given page.
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
