7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » flv not showing
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 1452 Views |
-
flv not showing

23 December 2010 at 9:56am
Hi All,
I hav Filedom up and working (local with Mamp). I can upload mp3 or flv, but instead of showin on the page, a link shows up. When i click the link, the mp3 plays in another window. When i click the flv link. Firefox ask to dowload.
here's my code
download.php
<?php
class Download extends DataObject
{
static $db = array (
'Naam' => 'Text',
'Omschrijving' => 'Text',
);static $has_one = array (
'Bijlage' => 'File',
'DownloadPage' => 'DownloadPage'
);public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Naam'),
new TextareaField('Omschrijving'),
new FileIFrameField('Bijlage')
);
}
}?>
downloadpage.php
<?php
class DownloadPage extends Page
{
static $has_many = array (
'Bijlagen' => 'Download'
);public function getCMSFields()
{
$f = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this, // Controller
'Bijlagen', // Source name
'Download', // Source class
'Bijlage', // File name on DataObject
array(
'Naam' => 'Name',
'Omschrijving' => 'Description',
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$f->addFieldToTab("Root.Content.Downloads",$manager);
return $f;
}
}
class DownloadPage_Controller extends Page_Controller {function AllDownloads() {
return $this->data()->Bijlagen();
}
};?>
downloadpage.ss
<div class="typography">
<h2>$Title</h2>
$Content
<% control allDownloads %><a href="$Bijlage.Filename">$Bijlage.FileName - $Bijlage.Size</a>
<p>$Omschrijving</p>
<% end_control %>
</div>Note: I can only use $Bijlage.Filename. When i use just $Bijlage, i get a server error
Can somebody help me out.
Thanks -
Re: flv not showing

23 December 2010 at 11:14am Last edited: 23 December 2010 11:16am
Hi Guy,
if you'd like to show the movie (flv) in an embedded player, you have to do a little more.
For embedding a movie you have to use a player as container for these movies.
E.g. http://www.longtailvideo.com/players/jw-flv-player/
Download the files an put them e.g in /themes/<your-theme>/swf/*
Untested Template Code:
<% require javascript(http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js) %>
<div class="typography">
<h2>$Title</h2>
$Content<% control allDownloads %>
<p id="container_$Pos">Please install the Flash Plugin</p>
<script type="text/javascript">
var flashvars = { file:'$Bijlage.Filename',autostart:'false' };
var params = { allowfullscreen:'true', allowscriptaccess:'always' };
var attributes = { id:'player_$Pos', name:'player_$Pos' };swfobject.embedSWF('themes/<your-theme>/swf/player.swf','container_$Pos','480','270','9.0.115','false',
flashvars, params, attributes);
</script>
<% end_control %>
</div>This example should only demonstrate the principle .....
-
Re: flv not showing

23 December 2010 at 12:11pm Last edited: 23 December 2010 12:12pm
If you cast your file as "FLV" or "MP3", then all you need is $YourFileObject.Player. It automatically includes all of that stuff above..
---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com -
Re: flv not showing

23 December 2010 at 12:20pm
Ahh, good to know ....
@UC - did you get my Email this week regarding my uploadify/swfupload problems ?
-
Re: flv not showing

23 December 2010 at 8:26pm Last edited: 23 December 2010 8:51pm
Hi UncleCheese,
I tried to adress the attachments (a jpg, pdf, mp3 and flv file) (Bijlage) in my download.ss file as $Bijlage.Player, but no luck, nothing shows. (except for the link, cfr. the next line) Here's my code for the dowload.ss files. Can you tell me what i'm doing wrong. I also noticed that the there's no video icon in the cms next to the flv-file. The icon that shows up is a kind of a blank paper.
<div class="typography">
<h2>$Title</h2>
$Content
<% control allDownloads %>
$Bijlage.Player
<a href="$Bijlage.Filename">$Bijlage.FileName - $Bijlage.Size</a>
<p>$Omschrijving</p>
<% end_control %>
</div>Hope you guys can help me out and thanx for all the effort you put in this fantastic modulei
guy
-
Re: flv not showing

12 January 2011 at 11:21am
Hi UncleCheese
I have seen you post this a few times. What exactly do you mean and where should we cast?
-
Re: flv not showing

12 January 2011 at 12:00pm
You have to cast the File relation as FLV, not File..
$has_one = array (
'SomeFile' => 'FLV'
); -
Re: flv not showing

12 January 2011 at 6:45pm
Yeah, but if you do that "SomeFile" cannot be say mp3
In your screencast you just use the type file and it handles both flv and mp3
| 1452 Views | ||
| Go to Top | Next > |


