The filedataobjectmanager works really well, But I was just wondering if there was a way that I could have a page with all files pagination and a side navigation. To pages that can filter the files by category.
eg. a main download page with all files pagination any category.
and sub pages that filters to specific category pagination.
I was just wondering if any one could help me, with the best way of doing this>?
I'm sorry but I do not understand what i am meant to do, do i put this code in to ResourcePage.php, and do i have to change SomeFileObject and MyFileObjects i'm really sorry about this i am more a visual designer than coder, have no idea lol.
Add it to ResourcePage_Controller. You don't need to change the variable names. I was just using an example. If you're using the example code that comes with DataObjectManager, you can replace SomeFileObjects() with Resources(). If you're still having trouble, post your code for ResourcePage.php and I can show you where to add it.
FYI, you should avoid building sites on the code examples that come with DataObjectManager. I'm going to be taking them out of the module soon, since people have been complaining about injecting new page types into their site tree. If you really need those example files, you can move them to the mysite/code folder.
class ResourcePage extends Page
static $has_many = array (
'Resources' => 'Resource'
public function getCMSFields()
$f = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this, // Controller
'Resources', // Source name
'Resource', // Source class
'Attachment', // File name on DataObject
'Name' => 'Name',
'Description' => 'Description',
'Category' => 'Category'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
'Category', // Name of field to filter
'Filter by Category', // Label for filter
singleton('Resource')->dbObject('Category')->enumValues() // Map for filter (could be $dataObject->toDropdownMap(), e.g.)
// If undefined, all types are allowed. Pass with or without a leading "."
// Label for the upload button in the popup
$manager->setBrowseButtonText("Upload (PDF or DOC only)");
// In grid view, what field will appear underneath the icon. If left out, it defaults to the file title.
// Plural form of the objects being managed. Used on the "Add" button.
// If left out, this defaults to [MyObjectName]s
$filter = Director::urlParam('Action');
return $filter ? $this->Resources("Category = '$filter'") : $this->Resources();
class ResourcePage_Controller extends Page_Controller