This article explains the Application Panel in Dreamweaver MX.
It is part from the book Dynamic Dreamweaver MX written by many famous people including our own Omar Elbaga from the UDzone team!
This article explains the Application Panel in Dreamweaver MX.
It is part from the book Dynamic Dreamweaver MX written by many famous people including our own Omar Elbaga from the UDzone team!
On the same page, create a horizontal rule underneath the querystring link and form, and then insert the following code:
<form name="form1" method="post" action="create_request_variables.asp">
username: <input name="username" type="text" id="username" /><br />
password: <input name="user_pwd" type="password" id="user_pwd" /> <br />
<input type="submit" name="Submit" value="Submit" />
</form>
Now select Bindings, then Request Variables. In the pop-up box that appears, select Request.Form from the Type menu and type username in the Name field. Click OK. You will then see the username variable listed under Request in the Bindings window. Follow the same steps to also add the user_pwd form field and it will be added to the Request list.
As with the other variables, you can now call these variables to anywhere you want in your page by dragging and dropping them from the Bindings window into your code. When you enter values into your form and Submit it, the values will appear wherever you placed the variables.
On the same page, insert a horizontal rule below the form you just created. In Code View add the following code above the opening <html> tag:
<% Response.Cookies("ckSayHello") = "Hello" %>
In the same manner as we did before, select Bindings then Request Variables, choose Request.Cookie from the Type menu, and type ckSayHello in the Name field. If you now drag and drop the ckSayHello variable underneath the last horizontal rule you added, and view your page through a browser, the cookie variable should be displayed as the cookie is created once the page loads.
On the same page, insert a horizontal rule below the dynamic cookie variable you just created. In the same manner as before, bring up the Request Variables pop-up box. Select Request.ServerVariable from the Type menu and type remote_host in the Name field. OK this, then we should be able to drag and drop the remote_host variable from the Bindings window onto your page. View the page in a browser, and the ServerVariable should be displayed once the page loads.
You can also store session variables in the Bindings window. Of course we have to create one first. Create a new dynamic ASP web page and save it as create_session.asp. In Code View add the following code above the opening <html> tag:
<% Session("svSayGoodbye") = "Goodbye" %>
Select Bindings, then Session Variables. Type svSayGoodbye in the Name field and click OK. The variable should be listed under a "Session" heading in the Bindings window. Now we can drag and drop the svSayGoodbye variable onto our page, just like we did before with our Request Variables - now view the page in a browser, and the Session Variable should be displayed as the session is created once the page loads.
The Bindings area is another useful timesaving feature of Dreamweaver MX - use it as much as you can. It organizes your dynamic variables and keeps them accessible as you build documents. Another good reason to use it is that you won't have to remember the names of the dynamic variables after you have created them! Once you create a dynamic variable, always add it to the Bindings window for easy access to its value.
The Server Behaviors tab contains all the pre-built ASP code blocks that help us build our web applications except a few others that reside under Application Objects. The first and foremost server behavior we need to learn about is the Recordset behavior.
The Recordset behavior creates a recordset, which is a subset of database records. It is the object that sends an SQL query to a database, which then returns the data requested. The recordset is a part of the ADO (ActiveX Data Objects) set of objects that Microsoft created to provide ease of access to data stored in a wide variety of database sources. This object is called from our ASP page. Fortunately we do not need to know the ASP syntax to create a recordset object. In fact, you do not even have to know the SQL, but thanks to Chapter 6 you should be familiar with it.
Dreamweaver MX gives us two ways to create a recordset: Simple and Advanced modes. In simple mode you do not need to manually add the SQL. You will be able to manually write your SQL in advanced mode. It is up to you which mode you use, but if you know SQL then it is suggested that you use advanced mode. Simple mode only allows simple queries to be constructed. We will now create a sample recordset from the database. Once we create our recordset we will be able to drag and drop the records onto our page.
Let's retrieve the list of categories stored in the table named categories. Create a new Dynamic ASP, and call it categories.asp. Now, from the Bindings or Server Behaviors tab click the plus sign (+) and select Recordset (Query), and you should be presented with a pop-up box like this:
· Name your recordset rsCategories (it is a convention to prefix recordset names with "rs")
· Select the Connection you will be using (let's use the one we created earlier)
· Select the categories table, and select both fields
· We will not be filtering for any records as we just want to retrieve all the records, but it would be nice to sort the records in alphabetical order. From the first Sort drop-down menu select the category column; from the second one, select Ascending
For future reference, only select the columns that you need. Retrieving columns that will not be used only slows down the execution time.
Hit the Test button, and Dreamweaver MX will sent the query to the database to test it - if successful, a box should pop up showing you all the records retrieved for that recordset.
Now OK the test box and click the Advanced button to take a look at the SQL Dreamweaver MX generated. We could have typed this in ourselves, but it has been done for us, saving us time. Switch back to Simple mode and click OK.
Click the Bindings tab from the Application Panel and you will see that the records are now available for our page, displayed in expandable tree form. Now, on our ASP, create an HTML table with 2 rows and 2 columns with 50% width, similar to what you see below. Drag and drop the appropriate fields from Bindings into each table column respectively; it should look something like this in Design View:
Now view categories.asp through a browser - you should see something similar to this:
You may wonder why the first record is the only one showing - in the next section we will find out why and how you can display the rest of the records.
George Petrov is a renowned software writer and developer whose extensive skills brought numerous extensions, articles and knowledge to the DMXzone- the online community for professional Adobe Dreamweaver users. The most popular for its over high-quality Dreamweaver extensions and templates.
George is also the founder of Wappler.io - the most Advanced Web & App Builder
Comments
Hello to everybody
textsing
RE: Hello to everybody
You must me logged in to write a comment.