Silverstripe Version:
Version 4.6
CWP 2.6
Question:
What’s the easiest way of extracting all the page IDs and the relevant URLs and Page Titles associated with the ID?
Ideally in a CSV file or something that I can use to map to a new navigation.
Are there any reports I can run?
// Include any relevant code. If you have a lot of code, link to a gist instead.
bauke
2
You can create a custom report, to use in the CMS. There is also an option to ‘Export as CSV’.
Save this file PageReport.php in your app/src folder:
<?php
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Reports\Report;
class PageReport extends Report
{
public function title()
{
return 'All pages';
}
public function sourceRecords($params = null)
{
return SiteTree::get();
}
public function columns()
{
return array(
"ID" => array(
"title" => "ID",
"link" => true,
),
"Title" => array(
"title" => "Title",
"link" => true,
),
"AbsoluteLink" => array(
"title" => "URL",
"link" => false,
)
);
}
}