Need help embedding a javascript player to a page

Paul Green's picture

Okay, I'm really frustrated by this. In our old D6 site, I could just embed the js code in a page, and have it set up as a block to offer a streaming player hooked up to our shoutcast stream.

But now? How in the world do I go about embedding a player into the D7 site? From what I've read, I have to locate some bloody PHP file somewhere and modify it in order to do this. I'm not a coder, and this seems to have really overcomplicated what had been a fairly easy and straighforward process.

I'm seriously thinking about ditching Drupal for something that's a bit more manageable if I can't get this figured out.

We built a new site using OpenPublish to match our sister site's newspaper page, and we've got about a month and a half to get this figured out, or we're pretty much shafted.

Any help at all would be greatly appreciated.


Stop talking like a crybaby

joelwallis's picture

Stop talking like a crybaby. Just ask for help and be direct.

Have you checked in the documentation? You can create blocks just in the same way you are used to do with D6. In fact you dont need to create a PHP file to print some markup. You can create a block and set the input format to Full HTML, and type your front-end code there.

Template files are a better solution when you have multiple environments and the code is controlled by a source code controller like git or subversion. if youre not a coder you can bypass these goodo pratices related t software developnebt and just do your job done.

remember drupal is a soft cms for enterprise level solutions. if you just need a crapy cms to get some shits done, joomla or wordpress can be a better solution.

You can't...sorry.

Paul Green's picture

When you copy/paste the js to the page, even when full html is enabled, D7's filters are stripping something out of the script in the background. I'm left with something that looks like this: with that.

And when I create a new block, with full html enabled, the result is this:

And looking into the issue just led me here:

And here:

Which doesn't do me a whole lot of good.

Are you using a wysiwyg

tripper54's picture

Are you using a wysiwyg editor to enter that source?

That's it's printing the source out on the page suggests it's being entity encoded at some point.


Paul Green's picture

Yep. It's CKEditor that's being used. It came bundled with the OpenPublish distro. Is there a workaround for that. Forgive me for being dense, but I've been struggling with this for hours.

Is there a "disable rich text

tripper54's picture

Is there a "disable rich text editor" link below the body field ? If so turn off the wysiwyg using that.

Otherwise it there is a 'view source' or 'view HTML' button in the toolbar, try using that to paste your source code in.

If neither of the above work you'll have to hunt around in your WYSIWYG config to figure out how to disable the encoding, otherwise just disable the WYSIWYG or ckeditor module while you enter this code, then enable it again later.

I've tried disabling the rich

Paul Green's picture

I've tried disabling the rich text editor to no avail. I'm about to disable the module, and see if that works.

EDIT: And disabling the WYSIWYG module solved the problem. Thanks for leading me to something I should have thought of earlier!!

OpenPublish is a soft distro.

joelwallis's picture

OpenPublish is a soft distro. It uses a responsive layout,so if you want to support this feature you must take cafe about the behavior of your front-end in msny screen types. But there's not difficulty to create a new block on it. You have set up the right permissions for the right users? Are you using the super user (that with uid = 1)?

Building as the Admin

Paul Green's picture

I've got full permissions for the entire installation, and they're all set correctly. The problem isn't in creating a new's getting the embedded javascript to work.

I created a block with the

joelwallis's picture

I created a block with the Full HTML filter, wrote some JS and see if it works fine:

The outputted block code:

The result in the Chromium's console:

It was the WYSIWYG editor

Paul Green's picture

It was the WYSIWYG editor that was stripping my code. I disabled the module, and the code translated perfectly.