How about something more abstracted:

...alt0{background-color: #fff;}
...alt0{background-color: #ffc;}

<cfscript>
function setRowClass(cr) {
        return "alt#cr MOD 2#";
}
</cfscript>

class="#setRowClass(currentRow)#"

A bit more typing on the one occurrence, but in the end you've more control
over all elements of the logic across the site (since you can make the UDF
available everywhere).

Just some more thoughts...

- Calvin

-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 10, 2005 5:46 PM
To: CF-Talk
Subject: Re: Few cfoutput Vs Many cfoutput

Take this block:

...alt0{background-color: #fff;}
...alt0{background-color: #ffc;}
class="alt#currentRow MOD 2#"

And this block:
bgcolor="<cfif currentRow MOD 2>##ffffff<cfelse>##ffffcc</cfif>"

Once you use it twice, the former is less typing overall(119 vs 129
chars), and that savings only increases per use (at 10 uses it's 350
to 640).  Not to mention the savings if you need to change the color
for some reason.  So "quick and dirty" is really an argument against
inlining your colors.  I will readily admit that the savings (in terms
of typing) is small enough to be ignored, but my point is more that
it's not a reason for doing things the bad old way either.

cheers,
barneyb

On Thu, 10 Feb 2005 12:38:57 -0600, Dawson, Michael <[EMAIL PROTECTED]>
wrote:
> Many of the apps I build are quick and dirty apps that generally don't
> have a wide audience and won't be used more than a few times.  I won't
> go to the trouble of creating a style sheet just to color every other
> row with MOD 2.  I know enough not to waste effort where it's not
> needed.
> 
> ;D
> 


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

Got Gmail? I have 50 invites.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194213
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