TinyMCE hack to shoehorn Paul Irish conditional statements into Cascade Server

Here is some code to shoehorn Paul Irish’s conditional statements for Internet Explorer into Hannon Hill’s Cascade Server using PHP’s ob_start() function. This is a mashup from a few people on the Cascade help forum. Really, it’s a TinyMCE (Cascade’s WYSIWYG editor) hack to get conditional code, i.e. comments, around the HTML tag. I know it’s a very specific use case, but if you are trying to make your web site responsive using HTML5 Boilerplate in Cascade you’ll want this. (Irony: WordPress’s WYSIWYG editor won’t save the code correctly so I took a screen shot.)

Paul Irish Cascade hack


Hannon Hill added a set of special tags in version 7.4 of Cascade that allow code – even “illegal” code – to sit in a page unrendered. You’ll find it in their knowledge base under Code Sections. Below is a revised version of the Boilerplate conditional statements using the new “protect-top” tag.


Un-Minimizing Attributes Written With PHP In TinyMCE

I think this is a “feature” of HH implementation of TinyMCE, but I noticed that the editor would “correct” my attributes when I wrote them properly in an PHP echo statement.

echo "<option value=\"$abc\" selected=\"selected\">$abc</option>\n";

would save as

echo "<option value=\"$abc\" selected="selected">$abc</option>\n";

which of course breaks PHP. No matter how I tried to trick it into using escaped quotes it always changed back to unescaped.

My solution was to use single quotes and concatenate the variables into the string:

echo '<option value="'.$abc.'" selected="selected">'.$abc.'</option>'."\n";

For your reference, here are the minimized attributes that will need this treatment:

compact compact=”compact”
checked checked=”checked”
declare declare=”declare”
readonly readonly=”readonly”
disabled disabled=”disabled”
selected selected=”selected”
defer defer=”defer”
ismap ismap=”ismap”
nohref nohref=”nohref”
noshade noshade=”noshade”
nowrap nowrap=”nowrap”
multiple multiple=”multiple”
noresize noresize=”noresize”

There should be a better way to do this. A lot of code is written the proper way in PHP and switching it is untenable.

I see my career in a whole new light

From LAMP (software bundle) – Wikipedia, the free encyclopedia

This research was inspired by an ad for Facebook Application Developer with Egg Haus. I had never heard that acronym before; the internet really is a learning tool.

UPDATE: After attending SXSW it appears the (free) world is moving past LAMP.
There is a lot of interest in hosted services – the Cloud.