Hello,
I am using a modified version of the sitemap tutorial and have a question about the new URLsegment under version 2.4.
Function has been modified from the sitemap tutorial. But the $page->URLSegment is outputting the correct page name but as it is in some instances a sub page of a page, the parent page can be missing.
Any ideas?
Cheers
Chris
code below.
private function makeList($pages) {
$output = "";
if(count($pages)) {
$output = '
<ul id="sitemap-list">';
foreach($pages as $page) {
if(!($page instanceof ErrorPage) && $page->ShowInMenus && $page->Title != $this->Title){
$output .= '
<li><a href="'.$page->URLSegment.'" title="'.Convert::raw2xml($page->Title).' page">'.Convert::raw2xml($page->MenuTitle).'</a>';
$whereStatement = "ParentID = ".$page->ID;
//$childPages = new DataObjectSet();
$childPages = DataObject::get("Page", $whereStatement);
$output .= $this->makeList($childPages);
$output .= '
</li>';
}
}
$output .= '
</ul>';
}
return $output;
}