A Quick Look at Dreamweaver CS4 - Part 4
Part 1 |
Part 2 |
Part 3 |
Part 4 |
Part 5 |
Part 6
Bindings Tab
The Bindings tab allows you to access a few different things. First, you have the ability to create Recordsets here too (same as you do in the Server Behaviors tab) … this should give you a hint as to how important Recordsets are in creating database driven websites.
Screenshot: bindings tab
You can also access some of PHP's power again using a point-and-click interface rather than have to write the actual PHP code. This includes:
- Form Variable
- URL Variable
- Session Variable
- Cookie Variable
- Server Variable
- Environment Variable
Let's quickly take a look at one these, the Session Variable.
So what are Session Variables?
Session is a mechanism in PHP that is there to resolve one of the hard parts of building database driven web sites — the statelessness of the Web. If you recall when we discussed the disconnected nature of the Web … well session variables allow you to make it connected.
In a nutshell, session variables are pieces of information about a particular user that you can track as they are using your PHP based web site. You can track say, what items they have selected in your online store (shopping carts typically use the Session mechanism) or you can track what pages they went to etc … Session variables are very powerful thing and you can expect to be using them all the time.
In the old days before sessions, tracking users from page to page was a lot of work! We used to either have create hidden form fields and pass data from page to page that way, or we used cookies. This was all done manually and it took up a lot of time.
Fortunately, PHP's Session mechanism takes care of all the hard work for you and once again, Dreamweaver makes it even easier with the Session Variable server behavior.
Nerd details:
PHP sessions use either a cookie or it appends a unique ID to the query string to tag users. To be clear, the information (for example: the products they selected) about the user is actually temporarily stored on the server; the cookie or query string only contains an ID identifying the user.
There is a lot more with regards to what the Bindings tab provides, and as we work through that book and get into building practical PHP pages, we will delve more deeply into these things.
Spry Dataset
You can use Dreamweaver's AJAX toolset (called: Spry) to insert data into your pages. Spry is basically a bunch of Javascript that can pull data in from XML and even HTML files without the user having to reload the entire page. In the Spry world, this is called a 'dataset'.
This becomes interesting when the datasource (the target XML or HTML file) changes (this can be done in the background with PHP for example) and then the Spry scripts can then redisplay that new data (on the fly) in your web page.
This is by the way, an example of AJAX at work and is a classic example of a key component of Web 2.0 pages. We will get more into that later on.
Components Tab (not used with PHP)
This is a tab that won't appear if you are in PHP/MySQL mode in Dreamweaver. It does appear if you are using another server model, like ColdFusion for example. I should clarify a couple of things before we move on:
What is ColdFusion?
ColdFusion is a competing technology to PHP that is now owned by Adobe. So ColdFusion does what PHP does but in a different way.
I could list the reasons why the PHP nerds think PHP is better and I could also list why the ColdFusion people think ColdFusion is better … but that is something I will leave you to research if you feel a need. That said, I am a firm believer in PHP for many reasons and that's why I wrote the book choosing the PHP server model and not any of the others.
What is a server model?
You probably guessed it by now, but just in case … the server model is a reference to the server technology you are using to build database driven web sites. PHP (for example) is one server model and ColdFusion is another. Dreamweaver CS4 lets you choose from several:
- PHP
- ColdFusion
- Classic ASP with VB
- Classic ASP with Javascript
- ...and a few others.
When you first set up a web site in Dreamweaver (using the Site Definition window), you have the option to set up the testing server, this is where you select which server model you are going to use. For our work, we will always be selecting the PHP/MySQL option.
Screenshot: choosing a server model.