Edit cfcs in dreamweaver, Build web pages that use cfcs, Define a recordset in a cfc – Adobe Dreamweaver CC 2014 v.13 User Manual
Page 660

Edit CFCs in Dreamweaver
Dreamweaver provides a streamlined way of editing the code of the ColdFusion components defined for your site. For example, you can add,
change, or delete any component function without leaving Dreamweaver.
To use this feature, your development environment must be set up as follows:
ColdFusion must be running locally.
In the advanced Site Definition dialog box in Dreamweaver, the Access type specified in the Testing Server category must be Local/Network.
In the advanced Site Definition dialog box, the path of your local root folder must be the same as the path of the testing server folder (for
example, c:\Inetpub\wwwroot\cf_projects\myNewApp\). You can examine and change these paths by selecting Site > Edit Sites.
The component must be stored in the local site folder or any of its subfolders on your hard disk.
Open any ColdFusion page in Dreamweaver and display the components in the Components panel. To display the components, open the
Components panel (Window > Components), select CF Components from the panel’s pop-up menu, and click the Refresh button on the panel.
Because ColdFusion is running locally, Dreamweaver displays component packages on your hard disk.
Use the following procedure to edit a component.
1. Open any ColdFusion page in Dreamweaver and display the components in the Components panel (Window > Components).
2. Select CF Components from the panel’s pop-up menu, and click the Refresh button on the panel.
Because ColdFusion is running locally, Dreamweaver displays component packages on your hard disk.
Note: To edit the CFC recordset visually, double-click it in the Bindings panel.
3. To edit a component file generally, open the package and double-click the component name in the tree view.
The component’s file opens in Code view.
4. To edit a specific function, argument, or property, double-click the item in the tree view.
5. Make your changes by hand in Code view.
6. Save the file (File > Save).
7. To see any new function in the Components panel, refresh the view by clicking the Refresh button on the panel toolbar.
Build web pages that use CFCs
One way to use a component function in your web pages is to write code in the page that invokes the function when the page is requested. You
can use Dreamweaver to help you write this code.
Note: For other ways to use components, see the ColdFusion documentation from within Dreamweaver (Help > Using ColdFusion).
1. In Dreamweaver, open the ColdFusion page that will use the component function.
2. Switch to Code view (View > Code).
3. Open the Components panel (Window > Components), and select CF Components from the panel’s pop-up menu.
4. Find the component you want and insert it using one of the following techniques:
Drag a function from the tree view to the page. Code is inserted in the page to invoke the function.
Select the function in the panel and click the Insert button on the panel toolbar (the second button on the right). Dreamweaver inserts the
code in the page at the insertion point.
5. If you insert a function that has arguments, complete the argument code by hand.
For more information, see the ColdFusion documentation from within Dreamweaver (Help > Using ColdFusion).
6. Save the page (File > Save).
Define a recordset in a CFC
Dreamweaver can help you define a recordset (also known as a ColdFusion query) in a ColdFusion component (CFC). By defining a recordset in a
CFC, you don’t need to define the recordset on each page that uses it. You define the recordset once in the CFC and use the CFC on different
pages.
Note: This feature is available only if you have access to a computer running ColdFusion MX 7 or later. For more information, see Enable the
ColdFusion enhancements.
1. Create or open an existing CFC file in Dreamweaver.
2. In the Bindings panel (Window > Bindings), click the Plus (+) button and select Recordset (Query) from the pop-up menu.
The Recordset dialog box appears. You can work in either the simple or the advanced Recordset dialog boxes.
3. To use an existing function in the CFC, select the function from the Function pop-up menu and skip to step 5.
653