
ColdFusion MX 7 Getting Started Experience Tutorial Page 39 of 47
Figure 55. The HTML
reflects the three displayed
columns
ColdFusion MX 7 is smart enough to dynamically determine where a row should start and end, based on a little
mathematical equation. You can easily change the display to two or even four columns by modifying the cfif
statements, rather than cutting-and-pasting hundreds of lines of HTML code.
21. Next, format the price. Simply modify the price variable to use the dollarFormat() function, as the following code
shows, and then browse the page to view the results.
Price: #dollarFormat(artwork.price)#<br>
Figure 56. Displaying the
price with a dollar sign
Learning Point: ColdFusion functions
ColdFusion MX 7 comes with a library of hundreds of functions for manipulating variables. These functions allow you to
easily manage numbers, dates, and even complex variables like structures and arrays.
The formatting of functions still includes number signs, as well as the variable that you want to target; however, the
variables are now enclosed within parentheses to make it clear to the ColdFusion server exactly what should be
processed.
22. The isSold database column stores a yes as a one (1) and a no as a zero (0). While this is more efficient for the
database, it is not great for your site visitors. Rather than simply printing out the artwork.isSold variable, you can
make use of the cfif tag here, to print out the word Sold! in red letters if the artwork.isSold variable is equal to
1. See the following code and figure:
Kommentare zu diesen Handbüchern