06.09
php
saved
davemo
Note
A web page can have children which in turn can have children (think 4 levels deep). I want the array to reflect that so I can parse it with a for each loop in order to build my site navigation dynamically. Right now the 1st childwebpage shows up, but any subsequent children do not show up inside the child web page array.
A web page can have children which in turn can have children (think 4 levels deep). I want the array to reflect that so I can parse it with a for each loop in order to build my site navigation dynamically. Right now the 1st childwebpage shows up, but any subsequent children do not show up inside the child web page array.
- // web_page.php (model)
- <?php
- class WebPage extends AppModel {
- var $name = 'WebPage';
- 'foreignKey' => 'parent_web_page_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
- ),
- 'foreignKey' => 'parent_web_page_id',
- 'dependent' => false,
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'exclusive' => '',
- 'finderQuery' => '',
- 'counterQuery' => ''
- );
- // app_controller.php (in my app directory, overriding the cake dir one).
- function getNavigation() {
- }
- // results of calling getNavigation()
- (
- (
- (
- (
- [id] => 1
- [title] => Gallery
- [created] => 2008-06-09 11:03:51
- [modified] => 2008-06-09 11:03:51
- [content] => gallery content.
- [parent_web_page_id] => 0
- [user_id] => 3
- [web_page_type_id] => 5
- [team_id] => 1
- [site_id] => 0
- [is_active] => 0
- )
- (
- (
- [id] => 2
- [title] => Home
- [created] => 2008-06-09 11:04:32
- [modified] => 2008-06-09 11:04:32
- [content] => gallery content.
- [parent_web_page_id] => 1
- [user_id] => 3
- [web_page_type_id] => 1
- [team_id] => 1
- [site_id] => 0
- [is_active] => 0
- )
- )
- )
- (
- (
- [id] => 2
- [title] => Home
- [created] => 2008-06-09 11:04:32
- [modified] => 2008-06-09 11:04:32
- [content] => gallery content.
- [parent_web_page_id] => 1
- [user_id] => 3
- [web_page_type_id] => 1
- [team_id] => 1
- [site_id] => 0
- [is_active] => 0
- )
- (
- )
- )
- (
- (
- [id] => 3
- [title] => News
- [created] => 2008-06-09 11:32:45
- [modified] => 2008-06-09 11:32:45
- [content] =>
- [parent_web_page_id] => 0
- [user_id] => 3
- [web_page_type_id] => 5
- [team_id] => 1
- [site_id] => 1
- [is_active] => 1
- )
- (
- (
- [id] => 4
- [title] => Home
- [created] => 2008-06-09 11:33:10
- [modified] => 2008-06-09 11:33:10
- [content] =>
- [parent_web_page_id] => 3
- [user_id] => 3
- [web_page_type_id] => 1
- [team_id] => 1
- [site_id] => 1
- [is_active] => 1
- )
- )
- )
- (
- (
- [id] => 4
- [title] => Home
- [created] => 2008-06-09 11:33:10
- [modified] => 2008-06-09 11:33:10
- [content] =>
- [parent_web_page_id] => 3
- [user_id] => 3
- [web_page_type_id] => 1
- [team_id] => 1
- [site_id] => 1
- [is_active] => 1
- )
- (
- (
- [id] => 5
- [title] => Other Information
- [created] => 2008-06-09 11:54:29
- [modified] => 2008-06-09 11:54:29
- [content] => Content
- [parent_web_page_id] => 4
- [user_id] => 3
- [web_page_type_id] => 1
- [team_id] => 1
- [site_id] => 1
- [is_active] => 1
- )
- )
- )
- (
- (
- [id] => 5
- [title] => Other Information
- [created] => 2008-06-09 11:54:29
- [modified] => 2008-06-09 11:54:29
- [content] => Content
- [parent_web_page_id] => 4
- [user_id] => 3
- [web_page_type_id] => 1
- [team_id] => 1
- [site_id] => 1
- [is_active] => 1
- )
- (
- )
- )
- )
- )
Parsed in 0.274 seconds, using GeSHi 1.0.7.14