2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2020

03/01/2003: How to Reduce HTML Size Yet Still Use Long Style Names Using ColdFusion

How to Reduce HTML Size Yet Still Use Long Style Names Using ColdFusion

Here's a suggestion for dealing with styles donated by Steve Runyon.

Long style names, like "tabCellSelected" or "tabCellUnselected", cause HTML page sizes to grow. For example, if you have a table with 8 columns and 20 rows, with 1 column selected, you're expending 2680 bytes on the names of the styles. ((7 * 20 * 17) + (1 * 20 * 15) = 2680)

The page size can be reduced by creating (application?) variables named like the style, whose values are short placeholders:

<cfset application.TabCellSelected_sty = "s001">
<cfset application.TabCellUnselected_sty = "s002">

Your style definitions then look like this:

TD.#application.TabCellSelected_sty# {
	[etc]
}
TD.#application.TabCellUnselected_sty# {
	[etc]
}

And your generated html looks like this:

<td class=s001>data</td>
<td class=s002>data</td>

On that same 8x20 table, you're now using only 640 bytes for the styles. (8 * 20 * 4)

03/01/2003: Making ColdFusion Modules More Secure

Making ColdFusion Modules More Secure

While reading an article written by Matt Reider (Macromedia), I noticed the following tidbit that ensures that a CF module is not called directly via a URL.

<!--- security - this template must be called as a custom tag --->
<CFIF NOT isDefined("caller")>
    <CFABORT>
<CFELSE>
    <!---
        make sure caller is a structure� otherwise
        they could have passed it in the URL
     --->
    <CFIF NOT isStruct(caller)>
        <CFABORT>
    </CFIF>
</CFIF>