The task is not new, adding JW Player to Silverstripe. The DataObjectManager from UncleCheese is doing a great job so far, but I would like to have it a little more flexible. I have come across this http://doc.silverstripe.org/doku.php?id=recipes:customising-content-in-your-templates and thought it might be well working for me.
So I added
function Content() {
return str_replace('$video', $this->silverVideo(), $this->Content);
}
// see the $this->PaypalButton() string up 2 lines? well that calls the Paypal() method below
function silverVideo() {
return $this->renderWith('video');
}
to the Page_Controller class and the tried different ways with including the JW Player embedding code.
Trying for a while now, I have come to the point where I simply not understand why Silverstripe is behaving like this. I have used the <object> and <embed> tag to include the JW Player to the site, simply using a $video token. I have also tried with using php to start the player, with no result at all. Using the code on a non-SS site, it`s fully working and behaving like it should be.
Does anyone got an idea, how to have this code
<script type='text/javascript' src='http://www.mysite/player/swfobject.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
var so = new SWFObject('http://www.mysite/player/player.swf','mpl','420','315','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addVariable('author','');
so.addVariable('description','');
so.addVariable('file','http://www.mysite/player/twister2009.flv');
so.addVariable('controlbar','none');
so.addVariable('autostart','true');
so.write('mediaspace');
</script>
run by SS without kicking all the TinyMCE rules and hacking the back of the system?
When reading the forums, this is a problem not only I have. So it might be of public interest to have this solved.
Ideas anyone?