Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

DataObjectmanager - Display File Frontend

Go to End

3 Posts   1615 Views


Community Member, 99 Posts

29 April 2010 at 2:58am

Edited: 29/04/2010 3:04am

There doesn't seem to be anything about how to display my .pdf on the frontend in the docs
unless I'm missing something

class Resource extends DataObject
static $db = array (
'Name' => 'Text',
'Description' => 'Text',
'Category' => "Enum('Brochure, EPC, HIPS, FloorPlan')"

static $has_one = array (
'Attachment' => 'File',
'HousePage' => 'HousePage'

public function getCMSFields_forPopup()
return new FieldSet(
new TextField('Name'),
new TextareaField('Description'),
new DropdownField('Category','Category', singleton('Resource')->dbObject('Category')->enumValues()),
new FileIFrameField('Attachment')


static $db = array(

static $has_many = array(
'Bullets' => 'Bullet',
'Rooms' => 'Room',
'Resources' => 'Resource',
'ImageAttachments' => 'ImageAttachment'


function getCMSFields() {
$fields = 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

.ss FRONT Page

<% if Resources %>
<% control Resources %>

<li>$Name $File ?guess </li>
<% end_control %>
<% end_if %>

does anyone have any ideas


Forum Moderator, 4102 Posts

29 April 2010 at 3:31am



Community Member, 99 Posts

29 April 2010 at 3:36am

Thanks a million.

Its so easy when you know how. I was trying just $Attachment and all sorts.