Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Want to add Javascript code to the CMS / Jw Player

Go to End

2 Posts   1871 Views

OCO Pure

Community Member, 14 Posts

19 April 2010 at 8:20am

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 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');

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?

OCO Pure

Community Member, 14 Posts

21 April 2010 at 8:07am

Thanx to my buddy Stefan, he found the problem preventing the Javascript from being executed.

There seems to be a bug/feature within the system that is blocking templates with numbers in the .ss name. The secret was to change the name of the .ss file in the themes/yourtheme/templates/Includes directory to a name with only letters in it.