Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Audio and video not displaying in the front end

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 428 Views
  • ravik
    Community Member
    10 Posts

    Audio and video not displaying in the front end Link to this post

    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 {

    ResourcePage.ss (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.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.