- Dreamweaver User Guide
- Introduction
- Dreamweaver and Creative Cloud
- Dreamweaver workspaces and views
- Set up sites
- About Dreamweaver sites
- Set up a local version of your site
- Connect to a publishing server
- Set up a testing server
- Import and export Dreamweaver site settings
- Bring existing websites from a remote server to your local site root
- Accessibility features in Dreamweaver
- Advanced settings
- Set site preferences for transferring files
- Specify proxy server settings in Dreamweaver
- Synchronize Dreamweaver settings with Creative Cloud
- Using Git in Dreamweaver
- Manage files
- Create and open files
- Manage files and folders
- Getting and putting files to and from your server
- Check in and check out files
- Synchronize files
- Compare files for differences
- Cloak files and folders in your Dreamweaver site
- Enable Design Notes for Dreamweaver sites
- Preventing potential Gatekeeper exploit
- Layout and design
- CSS
- Understand Cascading Style Sheets
- Laying out pages using CSS Designer
- Using CSS preprocessors in Dreamweaver
- How to set CSS Style preferences in Dreamweaver
- Move CSS rules in Dreamweaver
- Convert inline CSS to a CSS rule in Dreamweaver
- Work with div tags
- Apply gradients to background
- Create and edit CSS3 transition effects in Dreamweaver
- Format code
- Page content and assets
- Set page properties
- Set CSS heading properties and CSS link properties
- Work with text
- Find and replace text, tags, and attributes
- DOM panel
- Edit in Live View
- Encoding documents in Dreamweaver
- Select and view elements in the Document window
- Set text properties in the Property inspector
- Spell check a web page
- Using horizontal rules in Dreamweaver
- Add and modify font combinations in Dreamweaver
- Work with assets
- Insert and update dates in Dreamweaver
- Create and manage favorite assets in Dreamweaver
- Insert and edit images in Dreamweaver
- Add media objects
- Adding videos in Dreamweaver
- Insert HTML5 video
- Insert SWF files
- Add audio effects
- Insert HTML5 audio in Dreamweaver
- Work with library items
- Using Arabic and Hebrew text in Dreamweaver
- Linking and navigation
- jQuery widgets and effects
- Coding websites
- About coding in Dreamweaver
- Coding environment in Dreamweaver
- Set coding preferences
- Customize code coloring
- Write and edit code
- Code hinting and code completion
- Collapse and expand code
- Reuse code with snippets
- Lint code
- Optimize code
- Edit code in Design view
- Work with head content for pages
- Insert server-side includes in Dreamweaver
- Using tag libraries in Dreamweaver
- Importing custom tags into Dreamweaver
- Use JavaScript behaviors (general instructions)
- Apply built-in JavaScript behaviors
- About XML and XSLT
- Perform server-side XSL transformations in Dreamweaver
- Performing client-side XSL transformations in Dreamweaver
- Add character entities for XSLT in Dreamweaver
- Format code
- Cross-product workflows
- Installing and using extensions to Dreamweaver
- In-App updates in Dreamweaver
- Insert Microsoft Office documents in Dreamweaver (Windows only)
- Working with Fireworks and Dreamweaver
- Edit content in Dreamweaver sites using Contribute
- Dreamweaver-Business Catalyst integration
- Create personalized email campaigns
- Templates
- About Dreamweaver templates
- Recognizing templates and template-based documents
- Create a Dreamweaver template
- Create editable regions in templates
- Create repeating regions and tables in Dreamweaver
- Use optional regions in templates
- Define editable tag attributes in Dreamweaver
- How to create nested templates in Dreamweaver
- Edit, update, and delete templates
- Export and import xml content in Dreamweaver
- Apply or remove a template from an existing document
- Edit content in Dreamweaver templates
- Syntax rules for template tags in Dreamweaver
- Set highlighting preferences for template regions
- Benefits of using templates in Dreamweaver
- Mobile and multiscreen
- Dynamic sites, pages and web forms
- Understand web applications
- Set up your computer for application development
- Troubleshoot database connections
- Removing connection scripts in Dreamweaver
- Design dynamic pages
- Dynamic content sources overview
- Define sources of dynamic content
- Add dynamic content to pages
- Changing dynamic content in Dreamweaver
- Display database records
- Provide and troubleshoot live data in Dreamweaver
- Add custom server behaviors in Dreamweaver
- Building forms using Dreamweaver
- Use forms to collect information from users
- Create and enable ColdFusion forms in Dreamweaver
- Create web forms
- Enhanced HTML5 support for form elements
- Develop a form using Dreamweaver
- Building applications visually
- Build master and detail pages in Dreamweaver
- Build search and results pages
- Build a record insert page
- Build an update record page in Dreamweaver
- Building record delete pages in Dreamweaver
- Use ASP commands to modify database in Dreamweaver
- Build a registration page
- Build a login page
- Build a page that only authorized users can access
- Securing folders in Coldfusion using Dreamweaver
- Using ColdFusion components in Dreamweaver
- Test, preview, and publish websites
- Troubleshooting
The user interface has been simplified in Dreamweaver and later. As a result, you may not find some of the options described in this article in Dreamweaver and later. For more information, see this article.
Define a recordset without writing SQL
You can create a recordset without manually entering SQL statements.
-
In the Document window, open the page that will use the recordset.
-
Select Windows > Bindings to display the Bindings panel.
-
In the Bindings panel, click the Plus (+) button and select Recordset (Query) from the pop‑up menu.
The simple Recordset dialog box appears. If you are developing a ColdFusion site, the Recordset dialog box is slightly different. (If the advanced Recordset dialog appears instead, click the Simple button to switch to the simple Recordset dialog box.)
-
Complete the Recordset dialog box for your document type.
For instructions, see the topics below.
-
Click the Test button to execute the query and ensure that it retrieves the information you intended.
If you defined a filter that uses parameters input by users, enter a value in the Test Value box, and click OK. If an instance of the recordset is successfully created, a table appears that displays data extracted from the recordset.
-
Click OK to add the recordset to the list of available content sources in the Bindings panel.
Options for the simple Recordset dialog box (PHP, ASP)
-
In the Name box, enter a name for the recordset.
A common practice is to add the prefix rs to recordset names to distinguish them from other object names in the code, for example: rsPressReleases.
Recordset names can only contain letters, numbers, and the underscore character (_). You cannot use special characters or spaces.
-
Select a connection from the Connection pop‑up menu.
If no connection appears in the list, click Define to create one.
-
In the Table pop‑up menu, select the database table that will provide data to the recordset.
The pop‑up menu displays all tables in the specified database.
-
To include a subset of the table’s columns in the recordset, click Selected and choose the desired columns by Control-clicking (Windows) or Command-clicking (Macintosh) them in the list.
-
To further limit the records returned from the table, complete the Filter section:
From the first pop‑up menu, select a column in the database table to compare against a test value you define.
From the second pop‑up menu, select a conditional expression to compare the selected value in each record against the test value.
From the third pop‑up menu, select Entered Value.
In the box, enter the test value.
If the specified value in a record meets your filtering condition, the record is included the recordset.
-
(Optional) To sort the records, select a column to sort by, and then specify whether the records should be sorted in ascending order (1, 2, 3... or A, B, C...) or descending order.
-
Click Test to connect to the database and create an instance of the data source, and click OK to close the data source.
A table appears displaying the returned data. Each row contains a record and each column represents a field in that record.
-
Click OK. The newly defined recordset appears in the Bindings panel.
Options for the simple Recordset dialog box (ColdFusion)
Define a recordset for ColdFusion document types as a source of dynamic content without you having to hand code SQL statements.
-
In the Name box, enter a name for the recordset.
A common practice is to add the prefix rs to recordset names to distinguish them from other object names in your code. For example: rsPressReleases
Recordset names can only contain letters, numbers, and the underscore character (_). You cannot use special characters or spaces.
-
If you’re defining a recordset for a ColdFusion component (that is, if a CFC file is currently open in Dreamweaver), select an existing CFC function from the Function pop‑up menu, or click the New Function button to create a new function.
Примітка.The Function pop‑up menu is only available if a CFC file is the current document and you have access to a computer running ColdFusion MX 7 or better.
The recordset is defined in the function.
-
Select a data source from the Data Source pop‑up menu.
If no data source appears in the pop‑up menu, you must create a ColdFusion data source.
-
In the Username and Password boxes, enter the user name and password for the ColdFusion application server if required.
Data sources in ColdFusion may require a user name and password to access them. If you do not have the user name and password to access a data source in ColdFusion, contact your organization’s ColdFusion administrator.
-
In the Table pop‑up menu, select the database table that will provide data to the recordset.
The Table pop‑up menu displays all tables in the specified database.
-
To include a subset of the table’s columns in the recordset, click Selected and choose the desired columns by Control‑clicking (Windows) or Command-clicking (Macintosh) them in the list.
-
To further limit the records returned from the table, complete the Filter section:
From the first pop‑up menu, select a column in the database table to compare against a test value you define.
From the second pop‑up menu, select a conditional expression to compare the selected value in each record against the test value.
From the third pop‑up menu, select Entered Value.
In the box, enter the test value.
If the specified value in a record meets your filtering condition, the record is included in the recordset.
-
(Optional) To sort the records, select a column to sort by, and then specify whether the records should be sorted in ascending (1, 2, 3... or A, B, C...) or descending order.
-
Click Test to connect to the database and create an instance of the data source.
A table appears displaying the returned data. Each row contains a record and each column represents a field in that record. Click OK to close the test recordset.
-
Click OK. The newly defined ColdFusion recordset appears in the Bindings panel.
Define an advanced recordset by writing SQL
Write your own SQL statements by using the advanced Recordset dialog box, or create a SQL statement by using the graphical Database Items tree.
-
In the Document window, open the page that will use the recordset.
-
Select Windows > Bindings to display the Bindings panel.
-
In the Bindings panel, click the Plus (+) button and select Recordset (Query) from the pop‑up menu.
The advanced Recordset dialog box appears. If you are developing a ColdFusion site, the Recordset dialog box is slightly different. (If the simple Recordset dialog box appears instead, switch to the advanced Recordset dialog box by clicking the Advanced button.)
-
Complete the advanced Recordset dialog box.
For instructions, see the topics below.
-
Click the Test button to execute the query and ensure that it retrieves the information you intended.
If you defined a filter that uses parameters input by users, the Test button displays the Test Value dialog box. Enter a value in the Test Value box and click OK. If an instance of the recordset is successfully created, a table displaying the data from the recordset appears.
-
Click OK to add the recordset to the list of available content sources in the Bindings panel.
Options for the advanced Recordset dialog box (PHP, ASP)
Define a recordset as a source of dynamic content by writing a custom SQL statement, or by creating a SQL statement using the graphical Database Items tree.
-
In the Name box, enter a name for the recordset.
A common practice is to add the prefix rs to recordset names to distinguish them from other object names in the code. For example: rsPressRelease
Recordset names can only contain letters, numbers, and the underscore character (_). You cannot use special characters or spaces.
-
Select a connection from the Connection pop‑up menu.
-
Enter a SQL statement in the SQL text area or use the graphical Database Items tree at the bottom of the dialog box to build a SQL statement from the chosen recordset.
Do the following to use the Database Items tree to build the SQL statement:
Ensure the SQL text area is blank.
Expand the branches of the tree until you find the database object you need—a column in a table, for example, or a stored procedure in the database.
Select the database object and click one of the buttons on the right side of the tree.
For example, if you select a table column, the available buttons are SELECT, WHERE, and ORDER BY. Click one of the buttons to add the associated clause to your SQL statement.
You can also use a predefined SQL statement in a stored procedure by selecting the stored procedure from the Database Items tree and clicking the Procedure button. Dreamweaver automatically fills in the SQL and Variable areas.
-
If the SQL statement contains variables, define their values in the Variables area by clicking the Plus (+) button and entering the variable’s name, type (integer, text, date, or floating point number), default value (the value the variable should take if no run-time value is returned), and run-time value.Примітка.
When using variables in a SQL statement in PHP, Dreamweaver automatically adds a leading dollar sign to the variable name, so you should omit the dollar sign (e.g., colname, instead of $colname).
If the SQL statement contains variables, make sure the Default Value column of the Variables box contains valid test values.
The run-time value is usually a URL or form parameter entered by a user in an HTML form field.
URL parameters in the Run-time Value column:
Server Model
Run-Time value expression for URL parameter
ASP
Request.QueryString(“formFieldName”)
PHP
$_GET['formFieldName']
Form parameters in the Run-time Value column:
Server Model
Run-Time value expression for form parameter
ASP
Request.Form(“formFieldName”)
PHP
$_POST['formFieldName']
-
Click Test to connect to the database and create an instance of the recordset.
If the SQL statement contains variables, make sure the Default Value column of the Variables box contains valid test values before clicking Test.
If successful, a table appears displaying the data in your recordset. Each row contains a record and each column represents a field in that record. Click OK to clear the recordset.
-
If satisfied with your work, click OK.
Options for the advanced Recordset dialog box (ColdFusion)
Use the advanced Recordset dialog box to write custom SQL queries, or use the Database Items tree to author SQL queries using a point-and-click interface.
-
In the Name box, enter a name for the recordset.
A common practice is to add the prefix rs to recordset names to distinguish them from other object names in your code. For example: rsPressReleases
Recordset names can only contain letters, numbers, and the underscore character (_). You cannot use special characters or spaces.
If you’re defining a recordset for a ColdFusion component (that is, if a CFC file is currently open in Dreamweaver), select an existing CFC function from the Function pop‑up menu, or click the New Function button to create a new function.
Примітка.The Function pop‑up menu is only available if a CFC file is the current document and you have access to a computer running ColdFusion MX 7 or better.
The recordset is defined in the function.
-
Select a data source from the Data Source pop‑up menu.
If no data source appears in the pop‑up menu list, you will need to first create a ColdFusion data source.
-
In the Username and Password boxes, enter the user name and password for the ColdFusion application server if required.
Data sources in ColdFusion may require a user name and password to access them. If you do not have the user name and password to access a data source in ColdFusion, contact your organization’s ColdFusion administrator.
-
Enter a SQL statement in the SQL text area or use the graphical Database Items tree at the bottom of the dialog box to build a SQL statement from the chosen recordset.
-
(Optional) Do the following to use the Database Items tree to build the SQL statement:
Ensure the SQL text area is blank.
Expand the branches of the tree until you find the database object you need—for example, a column in a table.
Select the database object and click one of the buttons on the right side of the tree.
For example, if you select a table column, the available buttons are Select, Where, and Order By. Click one of the buttons to add the associated clause to your SQL statement.
If your SQL statement contains parameters, define their values in the Parameters area by clicking the Plus (+) button and entering the parameter’s name and default value (the value the parameter should take if no run-time value is returned).
If the SQL statement contains parameters, make sure the Default Value column of the Parameters box contains valid test values.
The Page Parameters allow you to provide default values for run-time value references in the SQL you write. For example, the following SQL statement selects an employee record based on the value of the employee’s ID. You can assign a default value to this parameter, ensuring that a run-time value is always returned. In this example, FormFieldName refers to a form field in which the user enters an employee ID:
SELECT * FROM Employees WHERE EmpID = + (Request.Form(#FormFieldName#))
The Add Page Parameters dialog box would contain a name-value pairing similar to:
Name
Default values
FormFieldName
0001
The run-time value is usually a URL or form parameter entered by a user in an HTML form field.
-
Click Test to connect to the database and create an instance of the recordset.
If the SQL statement contains run-time references, make sure the Default Value column of the Page Parameters field contains valid test values before clicking Test.
If successful, a table appears displaying the data in your recordset. Each row contains a record and each column represents a field in that record. Click OK to clear the recordset.
-
If satisfied with your work, click OK.
Define parameters in a SQL statement (ColdFusion)
Define parameters in a SQL statement; the default value is the value that the parameter should use if no run-time value is returned.
-
Select a parameter name from the Name pop‑up menu.
-
Enter a default value for the parameter in the Default Parameter box, and click OK.
Define parameters in a SQL statement (PHP)
Define parameters in a SQL statement; the default value is the value that the parameter should use if no run-time value is returned.
-
Enter a parameter name in the Name box.
-
Enter a default value for the parameter in the Default Parameter box.
-
Enter a run-time value for a parameter in the Run-time Value box, and click OK.
Create SQL queries using the Database Items tree
Instead of manually typing SQL statements into the SQL box, you can use the Database Item’s point-and-click interface to create complex SQL queries. The Database Items tree lets you select database objects and link them using the SQL SELECT, WHERE, and ORDER BY clauses. After you create a SQL query, you can define any variables using the Variables area of the dialog box.
The next two examples describe two SQL statements and the steps for creating them using the advanced Recordset dialog box’s Database Items tree.
Example: Selecting a table
This example selects the entire contents of the Employees table. The SQL statement defining the query appears as follows:
SELECT * FROM Employees
To create this query, follow these steps.
-
Expand the Tables branch to display all of the tables in the selected database.
-
Select the Employees table.
-
Click the Select button.
-
Click OK to add the recordset to the Bindings panel.
Example: Selecting specific rows from a table and ordering the results
The following example selects two rows from the Employees table, and selects the job type using a variable that you must define. The results are then ordered by employee name.
SELECT emplNo, emplName FROM Employees WHERE emplJob = 'varJob' ORDER BY emplName
-
Expand the Tables branch to display all of the tables in the selected database; then expand the Employees table to display the individual table rows.
-
Build the SQL statement as follows:
Select emplNo, and click the Select button.
Select emplName, and click the Select button.
Select emplJob, and click the Where button.
Select emplName, and click the Order By button.
-
Place the insertion point after WHERE emplJob in the SQL text area and type ='varJob' (include the equal sign).
-
Define the variable 'varJob' by clicking the Plus (+) button in the Variables area and entering the following values in the Name, Default Value, and Run-Time Value columns: varJob, CLERK, Request("job").
-
Click OK to add the recordset to the Bindings panel.
Define URL parameters
URL parameters store retrieved information input by users. Before you begin, make sure you pass a form or URL parameter to the server. After you define the URL variable, you can use its value in the currently selected page.
-
In the Document window, open the page that will use the variable.
-
Select Windows > Bindings to display the Bindings panel.
-
In the Bindings panel, click the Plus (+) button and select one of the following from the pop‑up menu:
Document Types
Menu item in Bindings panel for URL variable
ASP
Request Variable > Request.QueryString
ColdFusion
URL Variable
PHP
URL Variable
-
In the URL Variable dialog box, enter the name of the URL variable in the box, and click OK.
The URL variable name is normally the name of the HTML form field or object used to obtain its value.
-
The URL variable appears in the Bindings panel.
Define form parameters
Form parameters store retrieved information that is included in the HTTP request for a web page. If you create a form that uses the POST method, the data submitted by the form is passed to the server. Before you begin, make sure you pass a form parameter to the server. After you define the form parameter as a content source, you can use its value in your page.
-
In the Document window, open the page that will use the variable.
-
Select Windows > Bindings to display the Bindings panel.
-
In the Bindings panel, click the Plus (+) button and select one of the following from the pop‑up menu:
Document Types
Menu item in Bindings panel for form variable
ASP
Request Variable > Request.Form
ColdFusion
Form Variable
PHP
Form Variable
-
In the Form Variable dialog box, enter the name of the form variable, and click OK. The form parameter name is normally the name of the HTML form field or object used to obtain its value.
The form parameter appears in the Bindings panel.
Define session variables
You can use session variables to store and display information maintained for the duration of a user’s visit (or session). The server creates a different session object for each user and maintains it for a set period of time or until the object is explicitly terminated.
Before defining session variables for a page, you must create them in the source code. After you create a session variable in the web application’s source code, you can use Dreamweaver to retrieve its value and use it in a web page.
-
Create a session variable in the source code, and assign a value to it.
For example, this ColdFusion example instantiates a session called username, and assigns it the value Cornelius:
<CFSET session.username = Cornelius>
-
Select Window > Bindings to display the Bindings panel.
-
Click the Plus (+) button, and select Session Variable from the pop‑up menu.
-
Enter the name of the variable you defined in the application’s source code, and click OK.
Define application variables for ASP and ColdFusion
In ASP and ColdFusion, you can use application variables to store and display information that is maintained for the lifetime of the application and persists from user to user. After you define the application variable, you can use its value in a page.
There are no application variable objects in PHP.
-
Open a dynamic document type in the Document window.
-
Select Window > Bindings to display the Bindings panel.
-
Click the Plus (+) button, and select Application Variable from the pop‑up menu.
-
Enter the name of the variable as defined in the application’s source code, and click OK.
The application variable appears in the Bindings panel under the Application icon.
Use a variable as a data source for a ColdFusion recordset
When you define a recordset for a page in the Bindings panel, Dreamweaver enters the name of the ColdFusion data source in the cfquery tag on the page. For more flexibility, you can store a data source name in a variable and use the variable in the cfquery tag. Dreamweaver provides a visual method of specifying such a variable in your recordsets.
-
Make sure a ColdFusion page is active in the Document window.
-
In the Bindings panel, click the Plus (+) button and select Data Source Name Variable from the pop‑up menu.
The Data Source Name Variable dialog box appears.
-
Define a variable, and click OK.
-
When defining the recordset, select the variable as the data source for the recordset.
In the Recordset dialog box, the variable appears in the Data Source pop‑up menu along with the ColdFusion data sources on the server.
-
Complete the Recordset dialog box, and click OK.
-
Initialize the variable.
Dreamweaver does not initialize the variable for you so that you can initialize it how and where you want. You can initialize the variable in the page code (before the cfquery tag), in an include file, or in some other file as a session or application variable.
Define server variables
You define server variables as sources of dynamic content for use within a web application. Server variables vary from document type to document type and include form variables, URL variables, session variables, and application variables.
Server variables can be accessed by all clients that access the server, and by any applications running on the server. The variables persist until the server is stopped.
Define ColdFusion server variables
-
Open the Bindings panel (Window > Bindings). In the Server Variable dialog box, enter the name of the server variable, and click OK.
-
Click the Plus (+) button and select the server variable from the pop‑up menu.
-
Enter the name of the variable, and click OK. The ColdFusion server variable appears in the Bindings panel.
The following table lists the built‑in ColdFusion server variables:
Variable |
Description |
Server.ColdFusion.ProductName |
ColdFusion product name. |
Server.ColdFusion.ProductVersion |
ColdFusion version number. |
Server.ColdFusion.ProductLevel |
ColdFusion edition (Enterprise, Professional). |
Server.ColdFusion.SerialNumber |
Serial number of currently installed version of ColdFusion. |
Server.OS.Name |
Name of operating system running on the server (Windows XP, Windows 2000, Linux). |
Server.OS.AdditionalInformation |
Additional information about installed operating system (service packs, updates). |
Server.OS.Version |
Version of installed operating system. |
Server.OS.BuildNumber |
Build number of installed operating system. |
Define a ColdFusion local variable
Local variables are variables created with the CFSET or CFPARAM tag within a ColdFusion page. The defined local variable appears in the Bindings panel.
-
In the Local Variable dialog box, enter the name of the local variable and click OK.
Define ASP server variables
You can define the following ASP server variables as sources of dynamic content: Request.Cookie, Request.QueryString, Request.Form, Request.ServerVariables, and Request.ClientCertificates.
-
Open the Bindings panel (Window > Bindings).
-
Click the Plus (+) button, and select Request Variable from the pop‑up menu.
-
In the Request Variable dialog box, select one of the following request collections from the Type pop‑up menu:
The QueryString collection
Retrieves information appended to the sending page’s URL, such as when the page has an HTML form using the GET method. The query string consists of one or more name-value pairs (for example, last=Smith, first=Winston) appended to the URL with a question mark (?). If the query string has more than one name-value pair, they are combined with ampersands (&).
The Form collection
Retrieves form information included in the body of the HTTP request by an HTML form using the POST method.
The ServerVariables collection
Retrieves the values of predefined environment variables. The collection has a long list of variables, including CONTENT_LENGTH (the length of content submitted in the HTTP request, which you can use to see if a form is empty), and HTTP_USER_AGENT (provides information about the user’s browser).
For example, Request.ServerVariables("HTTP_USER_AGENT") contains information about the submitting browser, such as Mozilla/4.07 [en] (WinNT; I), which denotes a Netscape Navigator 4.07 browser.
For a complete list of ASP server environment variables, see the online documentation installed with Microsoft Personal Web Server (PWS) or Internet Information Server (IIS).
The Cookies collection
Retrieves the values of the cookies sent in an HTTP request. For example, suppose the page reads a cookie called "readMe" on the user’s system. On the server, the values of the cookie are stored in the variable Request.Cookies("readMe").
The ClientCertificate collection
Retrieves the certification fields from the HTTP request sent by the browser. The certification fields are specified in the X.509 standard.
-
Specify the variable in the collection that you want to access, and click OK.
For example, if you want to access the information in the Request.ServerVariables("HTTP_USER_AGENT") variable, enter the argument HTTP_USER_AGENT. If you want to access the information in the Request.Form("lastname") variable, enter the argument lastname.
The request variable appears in the Bindings panel.
Define PHP server variables
Define server variables as a source of dynamic content for PHP pages. The PHP server variables appear in the Bindings panel.
-
Open the Bindings panel (Window > Bindings).
-
Click the Plus (+) button, and select the variable from the pop‑up menu.
-
In the Request Variable dialog box, enter the name of the variable (for example, REQUEST_METHOD), and click OK.
For more information, search for the keyword $_SERVER in the PHP documentation.
Define a ColdFusion client variable
Define a ColdFusion client variable as a source of dynamic content for the page. The newly defined ColdFusion client variables appear in the Bindings panel.
-
In the Client Variable dialog box, enter the name of the variable, and click OK.
For example, to access the information in the Client.LastVisit ColdFusion variable, enter LastVisit.
Client variables are variables created in the code to associate data with a specific client. Client variables maintain the application’s state as the user moves from page to page within the application, as well as from session to session.
Client variables can be user-defined or built‑in. The following table lists the built‑in ColdFusion client variables:
Variable
Description
Client.CFID
An incremental ID for each client that connects to the server.
Client.CFTOKEN
A randomly generated number used to uniquely identify a particular client.
Client.URLToken
A combination of CFID and CFTOKEN to be passed between templates when cookies are not used.
Client.LastVisit
Records the timestamp of the last visit made by a client.
Client.HitCount
The number of page requests tied to a single client (tracked using CFID and CFTOKEN).
Client.TimeCreated
Records the timestamp when CFID and CFTOKEN were first created for a particular client.
Define a ColdFusion cookie variable
Cookie variables are created in the code, and access information contained in cookies passed to the server by a browser. The defined cookie variable appears in the Bindings panel.
-
In the Cookie Variable dialog box, enter the name of the cookie variable, and click OK.
Define a ColdFusion CGI variable
The defined CGI variable appears in the Bindings panel.
-
In the CGI Variable dialog box, enter the name of the variable, and click OK.
For example, if you want to access the information in the CGI.HTTP_REFERER variable, enter HTTP_REFERER.
The following table lists the most common ColdFusion CGI variables that are created on the server:
Variable
Description
SERVER_SOFTWARE
The name and version of the information server software answering the request (and running the gateway). Format: name/version.
SERVER_NAME
The server's hostname, DNS alias, or IP address as it appears in self-referencing URLs.
GATEWAY_INTERFACE
The revision of the CGI specification to which this server complies. Format: CGI/revision.
SERVER_PROTOCOL
The name and revision of the information protocol this request came in with. Format: protocol/revision.
SERVER_PORT
The port number to which the request was sent.
REQUEST_METHOD
The method with which the request was made. For HTTP, this is Get, Head, Post, and so on.
PATH_INFO
The extra path information, as given by the client. Scripts can be accessed by their virtual pathname, followed by extra information at the end of this path. The extra information is sent as PATH_INFO.
PATH_TRANSLATED
The server provides a translated version of PATH_INFO, which takes the path and does any virtual-to-physical mapping to it.
SCRIPT_NAME
A virtual path to the script being executed; used for self-referencing URLs.
QUERY_STRING
The query information that follows the question mark (?) in the URL that referenced this script.
REMOTE_HOST
The hostname making the request. If the server does not have this information, it sets REMOTE_ADDR and does not set REMOTE_HOST.
REMOTE_ADDR
The IP address of the remote host making the request.
AUTH_TYPE
If the server supports user authentication, and the script is protected, this is the protocol-specific authentication method used to validate the user.
REMOTE_USER AUTH_USER
If the server supports user authentication, and the script is protected, this is the user name they have authenticated as. (Also available as AUTH_USER.)
REMOTE_IDENT
If the HTTP server supports RFC 931 identification, this variable is set to the remote user name retrieved from the server. Use this variable for logging only.
CONTENT_TYPE
For queries that have attached information, such as HTTP POST and PUT, this is the content type of the data.
CONTENT_LENGTH
The length of the content as given by the client.
The following table lists the most common CGI variables created by the browser and passed to the server:
Variable
Description
HTTP_REFERER
The referring document. This is the document that linked to or submitted form data.
HTTP_USER_AGENT
The browser the client is currently using to send the request. Format: software/version library/version.
HTTP_IF_MODIFIED_SINCE
The last time the page was modified. This variable is sent at the discretion of the browser, usually in response to the server having sent the LAST_MODIFIED HTTP header. It can be used to take advantage of browser-side caching.
Cache content sources
You can cache—or store—sources of dynamic content in a Design Note. This lets you work on a site even if you don’t have access to the database or application server storing the sources of dynamic content. Caching may also speed up development by eliminating repeated access across a network to the database and application server.
-
Click the arrow button in the top right corner of the Bindings panel and toggle Cache in the pop‑up menu.
If you make changes to one of the content sources, you can refresh the cache by clicking the Refresh button (the circle-arrow icon) in the upper-right corner of the Bindings panel. (Expand the panel if you don’t see the button.)
Change or delete content sources
You can change or delete any existing source of dynamic content—that is, any content source listed in the Bindings panel.
Changing or deleting a content source in the Bindings panel does not change or delete any instance of that content on the page. It merely changes or deletes it as a possible source of content for the page.
Change a content source in the Bindings panel
-
In the Bindings panel (Window > Bindings), double-click the name of the content source you want to edit.
-
Make your changes in the dialog box that appears.
-
If satisfied with your work, click OK.
Delete a content source from the Bindings panel
-
In the Bindings panel (Window > Bindings), select the content source from the list.
-
Click the Minus (-) button.
Copy a recordset from one page to another page
You can copy a recordset from one page to another within a defined site.
-
Select the recordset in either the Bindings panel or the Server Behaviors panel.
-
Right-click the recordset, and select Copy from the pop‑up menu.
-
Open the page you want to copy the recordset to.
-
Right-click the Bindings panel or the Server Behaviors toolbar, and select Paste from the pop‑up menu.
More like this
- Database connections for ASP developers
- Database connections for PHP developers
- Add a stored procedure (ColdFusion)
- SQL primer
- About URL and form parameters
- Adding dynamic content to pages
- URL parameters
- ColdFusion server variables
- About dynamic content sources
- Using forms to collect information from users
- How session variables work
- Collecting, storing, and retrieving information in sessionvariables
- About adding dynamic content
- HTML form parameters
- ColdFusion server variables