2010-03-06, 07:40:19
I tried menu_data() and breaks the code. As you suggested I went to the pages.php and looked at how it lists the pages there. I ended up copying some code and turned it into a function:
I think if you guys include this into a global/common functions, then It can be useful for other plugin developers.
Code:
function getPages()
{
$path = GSDATAPAGESPATH;
//display all pages
$filenames = getFiles($path);
$count="0";
$pagesArray = array();
if (count($filenames) != 0) {
foreach ($filenames as $file) {
if (isFile($file, $path, 'xml')) {
$data = getXML($path .$file);
$status = $data->menuStatus;
//$pagesArray[$count]['title'] = $data->title;
$pagesArray[$count]['title'] = html_entity_decode($data->title, ENT_QUOTES, 'UTF-8');
$pagesArray[$count]['parent'] = $data->parent;
$pagesArray[$count]['menuStatus'] = $data->menuStatus;
$pagesArray[$count]['private'] = $data->private;
if ($data->parent != '') {
$parentdata = getXML($path . $data->parent .'.xml');
$parentTitle = $parentdata->title;
$pagesArray[$count]['sort'] = $parentTitle .' '. $data->title;
} else {
$pagesArray[$count]['sort'] = $data->title;
}
$pagesArray[$count]['url'] = $data->url;
$pagesArray[$count]['date'] = $data->pubDate;
$parentTitle = '';
$count++;
}
}
}
return $pagesArray;
}
I think if you guys include this into a global/common functions, then It can be useful for other plugin developers.