After seemingly perpetual frustration with CFMX's dump tag not
generating standards compliant CSS, I wrote a custom wrapper for the
tag.  In the /WEB-INF/cftags directory, move 'dump.cfm' to
'mmdump.cfm', create a new file named 'dump.cfm', and paste this code
in (watch the line wrap).  Once installed, continue to use CFDUMP
exactly as before, and watch it magically work again.  It works by
simply running a pair of REreplace calls on the output of CFDUMP to
insert hashes before hex colors and adding 'px' as a unit behind
numbers without a unit.

<cfif thistag.executionMode EQ "start"><cfsilent>
<cfparam name="attributes.var" />
<cfparam name="attributes.label" default="" />
<cfparam name="attributes.expand" default="true" />
<cfsavecontent variable="temp">
<cfmmdump var="#attributes.var#"
        label="#attributes.label#"
        expand="#attributes.expand#" />
</cfsavecontent>
<cfset temp = REreplace(temp, "color:
?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})", "color: ##\1", "all") />
<cfset temp = REreplace(temp, ": ?([0-9]+);", ": \1px;", "all") />
</cfsilent>
<cfoutput>#temp#</cfoutput>
</cfif>

I don't claim that it's perfect, but it's a hell of a lot better than
CFDUMP alone.  The code is public domain and carries no warranty of
any kind.

cheers,
barneyb

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193778
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to