Creating a source of dynamic content
Dynamic websites require a content source from which to extract data before they can display it on a web page. In Dreamweaver, these data sources can be databases, request variables, server variables, form variables, or stored procedures.
Before you can use these content sources in a web page, you must do the following:
- Create a connection to the dynamic content source (such as a database) and the application server processing the page
- Specify what information in the database you want to display, or what variables you want to include in the page
- Use Dreamweavers point-and-click interface to select and insert dynamic content elements into the selected page
Dreamweaver allows you to easily connect to a database and create a recordset from which to extract dynamic content. A recordset is the result of a database query. It extracts the specific information you request and allows you to display that information within a specified page. You define the recordset based on the information contained in the database and the content you want to display.
Different technology vendors may use different terminology for a recordset. In ASP and ColdFusion, a recordset is defined as a query. In JSP, a recordset is called a resultset. ASP.NET refers to a recordset as a DataSet. If you are using other sources of data, such as user input or server variables, the name of the data source that is defined in Dreamweaver is the same as the data source name itself.
To use a content source in Dreamweaver, you use the Bindings panel to create the data source. The Bindings panel, shown below, lets you create data sources for databases and different variable types. When you create a data source, it is stored in the Bindings panel where it can be selected and inserted into the current page.
To create a recordset in Dreamweaver, you use the Recordset dialog box. You can open the Recordset dialog box from either the Server pane of the Insert bar, or from the Bindings panel. The Simple Recordset dialog box lets you select an existing database connection and create a database query by selecting the table or tables whose data you want to include in the recordset. You can even use the Filter section of the dialog box to create simple search and return criteria for the query. You can test the query from within the Recordset dialog box, and make any needed adjustments before adding it to the Bindings panel.
Once a database connection is established, and a recordset defined, the recordset appears in the Bindings panel. From here you can import it into any web page within the defined site. The illustration below shows the Bindings panel with the recordset for an employee database open. You can insert any of the values shown into a web page by selecting the item, and clicking the Insert button at the bottom of the panel. The selected item is inserted into the specified placeholder within the page.
For information on databases, and the procedures needed to create a database connection, see the following chapters:
- Obtaining Data for Your Page
- "Beginners Guide to Databases,"