@@ -11,45 +11,45 @@ |
||
11 | 11 | |
12 | 12 | class SiteMap_Controller extends Page_Controller |
13 | 13 | { |
14 | - /** |
|
15 | - * This function will return a unordered list of all pages on the site. |
|
16 | - * Watch for the switch between $page and $child in the second line of the |
|
17 | - * foreach(). |
|
18 | - * |
|
19 | - * Note that this will only skip ErrorPage's at the top/root level of the site. |
|
20 | - * If you have an ErrorPage class somewhere else in the hierarchy, it will be |
|
21 | - * displayed. |
|
22 | - */ |
|
23 | - public function SiteMap() |
|
24 | - { |
|
25 | - // Pages at the root level only |
|
26 | - $rootLevel = Page::get()->filter('ParentID', 0); |
|
27 | - $output = ''; |
|
28 | - $output = $this->makeList($rootLevel); |
|
29 | - return $output; |
|
30 | - } |
|
14 | + /** |
|
15 | + * This function will return a unordered list of all pages on the site. |
|
16 | + * Watch for the switch between $page and $child in the second line of the |
|
17 | + * foreach(). |
|
18 | + * |
|
19 | + * Note that this will only skip ErrorPage's at the top/root level of the site. |
|
20 | + * If you have an ErrorPage class somewhere else in the hierarchy, it will be |
|
21 | + * displayed. |
|
22 | + */ |
|
23 | + public function SiteMap() |
|
24 | + { |
|
25 | + // Pages at the root level only |
|
26 | + $rootLevel = Page::get()->filter('ParentID', 0); |
|
27 | + $output = ''; |
|
28 | + $output = $this->makeList($rootLevel); |
|
29 | + return $output; |
|
30 | + } |
|
31 | 31 | |
32 | - private function makeList($pages) |
|
33 | - { |
|
34 | - $output = ''; |
|
35 | - if (count($pages)) { |
|
36 | - $output = ' |
|
32 | + private function makeList($pages) |
|
33 | + { |
|
34 | + $output = ''; |
|
35 | + if (count($pages)) { |
|
36 | + $output = ' |
|
37 | 37 | <ul class="sitemap-list">'; |
38 | - foreach ($pages as $page) { |
|
39 | - if (!($page instanceof ErrorPage) && $page->ShowInMenus && $page->Title != $this->Title) { |
|
40 | - $output .= ' |
|
38 | + foreach ($pages as $page) { |
|
39 | + if (!($page instanceof ErrorPage) && $page->ShowInMenus && $page->Title != $this->Title) { |
|
40 | + $output .= ' |
|
41 | 41 | <li><a href="'.$page->URLSegment.'" title="Go to the '.Convert::raw2xml($page->Title).' page">'.Convert::raw2xml($page->MenuTitle).'</a>'; |
42 | - $whereStatement = 'ParentID = '.$page->ID; |
|
43 | - //$childPages = new DataObjectSet(); |
|
44 | - $childPages = DataObject::get('Page', $whereStatement); |
|
45 | - $output .= $this->makeList($childPages); |
|
46 | - $output .= ' |
|
42 | + $whereStatement = 'ParentID = '.$page->ID; |
|
43 | + //$childPages = new DataObjectSet(); |
|
44 | + $childPages = DataObject::get('Page', $whereStatement); |
|
45 | + $output .= $this->makeList($childPages); |
|
46 | + $output .= ' |
|
47 | 47 | </li>'; |
48 | - } |
|
49 | - } |
|
50 | - $output .= ' |
|
48 | + } |
|
49 | + } |
|
50 | + $output .= ' |
|
51 | 51 | </ul>'; |
52 | - } |
|
53 | - return $output; |
|
54 | - } |
|
52 | + } |
|
53 | + return $output; |
|
54 | + } |
|
55 | 55 | } |