21309 Posts in 5738 Topics by 2603 members
|Go to End|
6 November 2009 at 12:56pm
I'm attempting to add video to a page using the HTML5 code suggested by Mark Pilgrim. I can upload the video files and can show the video on the page but haven't succeeded in joining the two ends together.
I created a new has-one relationship:
'mp4video' => 'File',
and set up the CMS fields to upload the files.
How do I get the file path in PHP? In the template I can use $mp4video.filename and it shows the correct data but any attempt to get info from $this->mp4video just generates an error message about trying to get the properties of a non-object.
I am currently doing this:
$mp4object = DataObject::get_by_id('File', $this->getField('mp4videoID'));
$mp4path = $mp4object->getField('Filename');
but it seems a roundabout route. Can someone help with what must be a very basic hole in my knowledge?
6 November 2009 at 2:31pm
6 November 2009 at 3:12pm
I knew it was simple. I just couldn't find an example.
|Go to Top|