Christopher's Broom Cupboard header image

February, 2010:

Tiplet: disabling TinyMCE's mangling of YouTube embed code

I've been hacking an install of phpns to make it work a little more neatly with my company's web site (which is a real Frankensite and in BAD need of a rip-and-replace).

Anyway, if you use phpns - or any CMS which uses TinyMCE for WYSIWYG text entry / editing - you'll find that if you embed code like YouTube links in code view, switch back to WYSIWYG view, then switch back to code view again... All your lovely embed codes are gone!

This was really annoying me, so I decided to have a hunt about for a quick 'n dirty solution. After lots of forum reading, a few things were clear:

  • TinyMCE won't let you easily disable its code cleaning / HTML verification, which sucks
  • Even the TinyMCE devs aren't quite sure how to efficiently stop this from happening
  • Trying to fully disable its HTML verification / cleanup routines is nigh-on impossible, the codebase is a spider's web of PHP
  • and by default, it hates all <object> and <embed> tags, even if you have the TinyMCE Flash plugin installed.

This can royally screw with your meticulously-entered YouTube embeds. However, on his blog, Akbar neatly demonstrates a simple but effective method to stop TinyMCE eating your embed code - and all you need to do is add the object and embed tags and possible variables... There's a full demo, with borrowable code, on his web site.

An experiment: buying new tyres online

Having been lucky enough to drive over a nail this week, and my front tyres having worn down a lot anyway, I bit the bullet and ordered two new tyres today. However, I thought I'd be shafted at Kwik Fit - so I decided to harness the power of the Internet and get some new tyres online. Such novelty!

After looking in all the nooks and crannies, I found a few useful sites: (more…)

SED #2: Birmingham City Council

I had an email correspondence with someone at BCC recently... Because of course, should I receive an email destined for someone else, I'm absolutely going to ring up some random person - the number is for the Capita-run 'Service Birmingham service desk' - and tell them about it (an almost guaranteed way to show yourself for the crazy person you are!)

Once again, corporate email policy results in signatures longer than the emails (and this time, with the mailserver tacking another copy on to each reply). (Linebreaks added for legibility)

The information contained within this e-mail (and any attachment) sent
by Birmingham City Council is confidential and may be legally privileged.
It is intended only for the named recipient or entity to whom it is
addressed. If you are not the intended recipient please accept our
apologies and notify the sender immediately, or telephone +(44)(0)121
464 4444. Unauthorised access, use, disclosure, storage or copying is
not permitted and may be unlawful. Any e-mail including its content may
be monitored and used by Birmingham City Council for reasons of security
and for monitoring internal compliance with the office policy on staff
use. E-mail blocking software may also be used. Any views or opinions
presented are solely those of the originator and do not necessarily
represent those of Birmingham City Council. We cannot guarantee that
this message or any attachment is virus free or has not been intercepted
and amended.