7935 Posts in 1536 Topics by 943 members
|Go to End|
28 September 2011 at 1:10am Last edited: 28 September 2011 1:12am
I'm using DOM's all over my site and it is working for files, images, audio etc..
Now i want to use it for video's. Grabbed the code from the example topic:
class VideoPage extends Page
static $has_many = array (
'Videos' => 'Video'
public function getCMSFields()
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Videos2", new FileDataObjectManager(
array('Title' => 'Title', 'Description' => 'Description'),
class VideoPage_Controller extends Page_Controller
class Video extends DataObject
static $db = array (
'Title' => 'Varchar(100)',
'Description' => 'Text'
static $has_one = array (
// Make sure this comes first
'VideoPage' => 'VideoPage',
* This relationship could be as simple as 'Video' => 'File' provided
* FileDataObjectManager::$upgrade_video is true (defaults to true).
* However, if we know the page will only contain videos, we can simplify things by
* using a direct relationship to FLV. This will give us the benefit of not having
* to worry about the allowed_file_types setting.
* To make this an audio resource, set the relationship to the MP3 class, e.g.
* 'AudioFile' => 'MP3'. Audio files are also subject to automatic upgrades, however,
* based on FileDataObjectManager::$upgrade_audio. (true by default).
'Video' => 'FLV'
Now, i've uploaded my files movie.mov & movie.flv to the assets folder via FTP. Went to the sync (dev/tasks) and synced it..
I go to VideoPage, tab Video2, upload, choose existing file, selected the movie.flv.. clicked save..
it loads.. you see the square appear, but no icon is in it!
When i Check Firebug, it says:
"NetworkError: 404 Not Found - http://www.mydomain.com/1137"
What is wrong here?
Why isn't it finding my file? They are truely there, i can go the the direct link and download them.
It is shared hosting, the server is running on windows i believe. Through the admin panel I've set-up the 'rights' on all assets- and sub folders.
28 September 2011 at 2:30am
Because you uploaded them with FTP, they were all assigned a ClassName of "File." Your DOM is looking for files with ClassName "FLV" so those relationships are all broken.
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com
28 September 2011 at 5:00am
Hi cheese, thanks for your reply! That makes sense, i can't upload them directly with the DOM, because of the file size. I get Filesize errors above 10mb. I guess this is a hosting setting? they aren't so cooperative, so im guessing i will have to deal with this..
what do you recommend? change the FLV to FILE? and use the template to control the file as a video?
30 September 2011 at 8:52am
I would just update the database afterwards and set all the new files to ClassName = 'FLV'
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com
4 October 2011 at 1:23am
Well, i think thats difficult, because my client uploads the file through FTP, but doesn't enter phpMyAdmin. Is there another way? Like a script to update the database, relation from FILE to FLV?
5 October 2011 at 9:53am
Solved it. Upload movie via FTP, Sync files, add movie to DOM from the assets folder. Relation of the movie is FILE.
Use template to control the $File.URL and use JWPlayer to get a nice FLV player.
|Go to Top|