MACROMEDIA COLDFUSION 5-DEVELOPING Manuale Utente Pagina 35

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 47
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 34
ColdFusion MX 7 Getting Started Experience Tutorial Page 35 of 47
The price is not formatted correctly and the number 1 appears instead of the word Sold. You will fix these problems
shortly. But first, recall from the cfdump results that there was more than just one art piece returned from the
database.
15. Return to the opening cfoutput tag and modify it to explicitly name the artwork variable as the query, as the
following code shows:
<table border="0" cellpadding="15" cellspacing="0" /jointfilesconvert/293559/bgcolor="#FFFFFF">
<tr>
<td valign="top" align="center" width="200">
<cfoutput query="artwork">
<img src="images/#artwork.largeImage#" width="200" height="200"><br>
<strong>#artwork.artName#</strong><br>
Artist: #artwork.firstName# #artwork.lastName#<br>
Price: #artwork.price#<br>
#artwork.mediaType# - #artwork.description#<br>
<font color="##FF0000">#artwork.isSold#</font>
</cfoutput>
</td>
</tr>
</table>
16. Save and browse the index.cfm page to see all of the artwork displayed in the browser. Then view the source.
Figure 53. The query
attribute to the cfoutput
tag tells ColdFusion to loop
through all the records from
the database
The query attribute of the cfoutput tag tells the ColdFusion server to loop over all the results that have been returned
from the database. The browser view source shows that the ColdFusion server has not only looped over the results of the
query to display every record, but has also stripped out all the variables and CFML tags to leave just HTML. The double-
number signs in the font color have been reduced to one number sign.
Vedere la pagina 34
1 2 ... 30 31 32 33 34 35 36 37 38 39 40 ... 46 47

Commenti su questo manuale

Nessun commento