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

UPDATE

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.

protect-top-cascade

My Notes of the Cascade 7 Webinar

My notes from the webinar about Cascade 7. Hannon Hill should have a video of this webinar on their site in a week or so.

June 5, 2012

Bradley Wagner

Themes

  1. Portability
  2. Performance
  3. End-user experience
  4. Interface/usability

Vitals

  1. Released May 8, 2012
  2. Over 65 downloads
  3. 2 Betas and client survey
  4. 400+ Votes satisfied
  5. Features for all stakeholders and user
    roles

DEMO: Content Portability

whole-site export that downloads .csse files

DEMO: Database export utility

everything expect binary files

DEMO: Site Clone/Copy

It keeps local references local to the copied site, and
external references (_common) stay external.

DEMO: Move/Rename Unpublish

Auto-unpublish when assets are moved/renamed. This
works on manual as well as expired assets (expiration folder
set).

DEMO: Modules

Easy way to add content e.g. twitter feed.

New >> Block >> Twitter Feed

Also swap out assets (blocks) on a page. with Inline
Regions

It dynamically updates the published page with new
Tweets!

DEMO: Spectate Connector

SAS marketing tool. Makes (empty) forms really easily.
Create connector in Cascade first, then use a new button on wysiwyg to drop
in form. Also, processes form data e.g. send email.

DEMO: Features – Caching (index
blocks)

Speeds up render on Cascade.

DEMO: Features – Improved History

Type ahead with action list when users scroll over
items.

DEMO: Features – Global Search

Type ahead added.

DEMO: Improved HTML5 Support

Embed video as HTML5. CAVEAT: Chrome doesn’t like
to render videos inline, but Safari will (Why?)

Also, improved Tidy – HTML5 nicer

My Questions:

Q: How does site copy handle locked files?

A: (They didn’t answer, but I think it will make a copy of the last saved version.)

Q: How does it hand internal asset references? One of
the problems we have when we copy now with 6.10.9 is
“hotlinking” images (or other assets).

A: It keeps local references local to the copied site,
and external references (_common) stay external.

Other Answers

Common assets (e.g. _common) need to exist before a site is copied.

Transport passwords are encrypted.

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:

HTML XHTML
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.