Another good suggestion!

Thanks, Chris!

Rick

-----Original Message-----
From: Peterson, Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 27, 2007 8:51 AM
To: CF-Talk
Subject: RE: Why wouldn't the first cell alternate colors with this code?

You could even write a quick udf to do this and make it even more
readable:

<cfscript>
Function altRow(row) {
        if (row mod 2 eq 1) {
                return '.high';
        }
        else {
                return '.low';
        }
}
</cfscript> 

Then just do:

<td class="#altRow(get_events.currentrow)#">
      #dateformat(get_events.event_date, "ddd")#
</td>

Chris Peterson
Gainey IT
Adobe Certified Advanced Coldfusion Developer

-----Original Message-----
From: gary gilbert [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 27, 2007 8:18 AM
To: CF-Talk
Subject: Re: Why wouldn't the first cell alternate colors with this
code?

Hi Rick,

If I may make a suggestion, put your style info into two classes and
then
this:

<cfif get_events.currentrow mod 2>
<td style="padding-top: 1px; padding-bottom: 2px; width: 35px;
border-left:
1px solid ##aaa; border-bottom: 1px solid ##aaa; background: ##ccc;
color:
black; font-size: 11px; font-weight: normal; text-align:
center;">#dateformat(get_events.event_date, "ddd")#</td> <cfelse>
               <td style="padding-top: 1px; padding-bottom: 2px; width:
35px; border-left: 1px solid ##aaa; border-bottom: 1px solid ##aaa;
background: ##eee; color: black; font-size: 11px; font-weight: normal;
text-align: center;">#dateformat(get_events.event_date, "ddd")#</td>

</cfif>

Will become:


<style>
....High{
padding-top: 1px;
padding-bottom: 2px;
width:35px;
border-left: 1px solid #aaa;
border-bottom: 1px solid #aaa;
background: #eee;
color: black;
font-size: 11px;
font-weight: normal;
text-align: center;
}

....Low {
padding-top: 1px;
padding-bottom: 2px;
width: 35px;
border-left:1px solid #aaa;
border-bottom: 1px solid #aaa;
background: #ccc;
color:black;
font-size: 11px;
font-weight: normal;
text-align:center;
}
</style>

.........


<td class="<cfif get_events.currentrow mod 2>.High<cfelse>.Low</cfif>">
      #dateformat(get_events.event_date, "ddd")# </td>

..........

Makes your code a bit more readable and weight a bit less.

Regards,
--
Gary Gilbert
http://www.garyrgilbert.com/blog






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289619
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to