
ColdFusion MX 7 Getting Started Experience Tutorial Page 44 of 47
7. Cut the query from the index.cfm page and paste it into the getArtwork function, between the cfset and the
cfreturn tags, as the following code shows:
<cfcomponent>
<cffunction name="getArtwork" access="public" returntype="query">
<cfset artwork="">
<cfquery name="artwork" datasource="cftutorial">
SELECT FIRSTNAME, LASTNAME, ARTNAME, DESCRIPTION, PRICE, LARGEIMAGE, ISSOLD,
MEDIATYPE
FROM ARTISTS, ART, MEDIA
WHERE ARTISTS.ARTISTID = ART.ARTISTID
AND ART.MEDIAID = MEDIA.MEDIAID
</cfquery>
<cfreturn artwork>
</cffunction>
</cfcomponent>
The cfreturn tag returns a query when the cffunction tag is called.
8. Save art.cfc.
9. The function is complete and now you can see it from the index.cfm page. Make sure that the index.cfm page is
open and that the Application panel is open on the Components tab, as the following figure shows. If it is not, you can
open it by selecting Window > Components from the menu bar.
10. Select the CF Components option from the drop-down list as shown in the following figure.
Figure 62. Opening the
Components panel
11. If prompted to do so, enter the RDS password you assigned when you installed ColdFusion MX 7. Click OK after you
type your password, and wait while Dreamweaver finds all of the components on your server.
Kommentare zu diesen Handbüchern