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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

ImageDataObjectManager i can't get this to work...

Go to End

18 Posts   2960 Views


Community Member, 135 Posts

19 October 2009 at 6:18am

ok I have checked the names and now have.



class Imagetest extends DataObject
static $db = array (
'Name' => 'Text',
'Description' => 'Text',
'Category' => "Enum('Industry, Finance, Education')"

static $has_one = array (
'ImagetestPage' => 'ImagetestPage',
'Attachment' => 'Image'


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




class ImagetestPage extends Page
static $has_many = array (
'Imagetests' => 'Imagetest'

public function getCMSFields()
$f = parent::getCMSFields();
$imagemanager = new ImageDataObjectManager(
$this, // Controller
'Imagetests', // Source name
'Imagetest', // 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
return $f;


class ImagetestPage_Controller extends Page_Controller {




<% if Menu(2) %>
<ul id="Menu2">
<% control Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="Go to the $Title page">$MenuTitle</a></li>
<% end_control %>
<% end_if %>

<div id="Content" class="typography">
<% if Level(2) %>
<div class="breadcrumbs">
<% end_if %>


<% control Imagetests %>
<% end_control %>



I dropped the imagetet table and rebuilt database.

Now when I click on Imagetest page in CMS it does not load at all?

why would this work for filedataobjectmanager and not image one?

Is there anytutorial on specifically the imagedataobjectmanager?


Community Member, 135 Posts

19 October 2009 at 8:48am

Hey unclecheese... you'll be glad to hear I got this working... i had to start new silverstripe installation. and just went and did imagedataobjectmanager page instead of file...

So I think I must have gor things confused with classes and tables etc..

I can now loop through the images. using the below

<% control Resources %>
<% control Attachment %>
<% end_control %>
<% end_control %>

and it is producing all my images to page.

Can I ask how do i access say number one or two individually? and just produce that to page... or if foe example I call one of my images 'logo' can i access just that in a particular place.

Go to Top