Macromedia invented the terms "behavior" and "server behavior" back in the days when they owned Dreamweaver. Both elements refer provide a method of adding interactivity to a web page by generating a variety of scripts which would often be time-consuming to create manually. The difference between the two types of behavior, as the names imply, is that server behaviors generate client-side scripts while server behaviors automatically create server-side code.
Dreamweaver Behaviors will always generate code written in JavaScript, by far the most commonly-used client-side scripting language. The code generated by JavaScript behaviors perform a number of useful function such as plug-in and browser detection and form validation. Some of these behaviors are a bit long in the tooth, have not been updated for several versions of Dreamweaver and, in some cases, have been superseded by Spry, Dreamweaver's implementation of Ajax.
Server behaviors can generate code in one of the five server-side scripting languages with which Dreamweaver is compatible: ASP, ASP.Net, ColdFusion, JSP and PHP. The language chosen is determined by the language specified as that which should be used on the testing server. This is part of the site definition and dictates the default document type for all new files.
Server behaviors offer a fairly wide range of features but most of them relate to the manipulation of data objects which are the main thrust of Dreamweaver's server-side development capabilities. One of the first behaviors new Dreamweaver developers will encounter is "Repeat Region". This allows you to select any element or region of a page and specify that it will repeat for as many items as there are in a given set of data. A classic use of this is the repetition of a table row or list item. Naturally, dynamic data, such as a product name, product image, product description, will also be inserted within the area being repeated.
Another very handy series of Dreamweaver server behaviors is Show Region which has six different variations on the same theme: "Show Region if Recordset is Empty","Show Region if Recordset is not Empty","Show Region if First Record", "Show Region if not First Record", "Show Region if Last Record" and "Show Region if not Last Record".
The first two of the Show Region server behaviors allow developers to create a page section which will only be displayed if a given data set is either empty or not empty. So, for example, you would select the entire repeat region mentioned above and use the "Show Region if Recordset is not Empty" behavior. Then you would create a message such as "Sorry, no records match your search criteria.", highlight it and use the "Show Region if Recordset is Empty" to make its display conditional.
Dreamweaver Behaviors will always generate code written in JavaScript, by far the most commonly-used client-side scripting language. The code generated by JavaScript behaviors perform a number of useful function such as plug-in and browser detection and form validation. Some of these behaviors are a bit long in the tooth, have not been updated for several versions of Dreamweaver and, in some cases, have been superseded by Spry, Dreamweaver's implementation of Ajax.
Server behaviors can generate code in one of the five server-side scripting languages with which Dreamweaver is compatible: ASP, ASP.Net, ColdFusion, JSP and PHP. The language chosen is determined by the language specified as that which should be used on the testing server. This is part of the site definition and dictates the default document type for all new files.
Server behaviors offer a fairly wide range of features but most of them relate to the manipulation of data objects which are the main thrust of Dreamweaver's server-side development capabilities. One of the first behaviors new Dreamweaver developers will encounter is "Repeat Region". This allows you to select any element or region of a page and specify that it will repeat for as many items as there are in a given set of data. A classic use of this is the repetition of a table row or list item. Naturally, dynamic data, such as a product name, product image, product description, will also be inserted within the area being repeated.
Another very handy series of Dreamweaver server behaviors is Show Region which has six different variations on the same theme: "Show Region if Recordset is Empty","Show Region if Recordset is not Empty","Show Region if First Record", "Show Region if not First Record", "Show Region if Last Record" and "Show Region if not Last Record".
The first two of the Show Region server behaviors allow developers to create a page section which will only be displayed if a given data set is either empty or not empty. So, for example, you would select the entire repeat region mentioned above and use the "Show Region if Recordset is not Empty" behavior. Then you would create a message such as "Sorry, no records match your search criteria.", highlight it and use the "Show Region if Recordset is Empty" to make its display conditional.
About the Author:
Author is a developer and trainer with Macresource Computer Solutions, a UK IT training company offering Adobe Dreamweaver training courses at their central London training centre.
No comments:
Post a Comment