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

Audio and video not displaying in the front end

Go to End



Community Member, 10 Posts

3 July 2012 at 7:52pm

hi sir,

I am a new for this platform,i have installed silverstripe v2.4.7 and it is working fine.
now i want to display audio and video in my website. for that i used the code below

Resource.php (I put this page into mysite/code/)
class Resource extends DataObject
static $db = array (
'Name' => 'Text',
'Description' => 'Text',
'Category' => "Enum('Industry, Finance, Education')"

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

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')

ResourcePage.php (I put this page into mysite/code/)
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
return $f;
class ResourcePage_Controller extends Page_Controller {
} (I put this page into theme/blackcandy/template/layout)
<div id="primaryContent" class="clearfix">
<div class="innerpad">
<% if URLSegment = Security %>
<% include WelcomeMessage %>
<% else %>
<% control Resources %>
<% control Attachment %>$Player(640,480)<% end_control %>
<% end_control %>

<% end_if %>
<div id="secondaryContent">
<div class="innerpad">
<div id="secondarynav">
<% if Children %>
<li><a href="$Link" class="current">$Title Overview</a></li>
<% else_if Level(2) %>
<li><a href="$Parent.Link">$Title Overview</a></li>
<% end_if %>
<% control Menu(2) %>
<li><a class="$LinkingMode" href="$Link">$MenuTitle</a></li>
<% end_control %>
<% include Callout %>
<div id="sideContent">
<div class="innerpad">

but the things is when i uploaded the file audio or video in the cms no problem, but when i go to front end there
Name, Description are displaying but the attachement file like audio and video is not displaying.

Please its my humble request, because from past one month i was spending time for this problem only.
please please give me the solution for this problem.