Dreamweaver/Ultradev - Server (Binding) Formats
Normally your dynamic data consists of text but easily could be dates, time, numbers, prices, or even a common hyperlink. Reguardless of what server language and database you use, there always will come a need to alter the display of your data that comes in.
Almost everything I cover in this article stays within the Dreamweaver interface and brings out a highly underutilized feature of Dreamweaver/Ultradev - Server (Binding) Formats. There is more mouse usage than keyboard action in this article.
This article will take you through the history and basics of Server Formats and will take you through two mini-projects showing how Server Formats not only save us time - but saves you from headaches!
What are Server (Binding) Formats?
Macromedia’s Dreamweaver documentation states Server Formats “enhance the display of dynamic data.” Additionally, they say “Server Formats let you apply different types of numerical, monetary, date/time, and percentage values to dynamic text.” Those statements definitely misrepresent what Server Formats are and especially how useful they really are! Here’s my rendition of what the documentation should say... Server Formats help to:
1. Stylize your dynamic data (not to be confused with CSS styling).
2. Automatically add numerical or textual values to your dynamic data.
Server Format example
A column in your database meant to be a product price may just show “20” as it’s entered data, but we and our customers expect different; that plain “20” should read “$20.00” on our site. Seems simple? Well, a basic formatting function may work for the first half of your day but it’ll become no good to us later by the afternoon. We need to think ahead, account for further scenarios – think under a dollar, over a dollar, over a thousand, even millions and billions! That’s where Server Formats become our best friend, they will automatically add the currency sign and handle decimal/thousandths seperator.
Don’t be confused when I refer to Server Formats as Server (Binding) Formats, they are the same thing. When a Server Format is applied to a Binding element, they are server formatted Bindings.
The term Binding is a Macromedia term, loosely used to describe dynamic data in your pages.
Macromedia does a pretty good job of nicknaming elements of web development/design. Afterall, Macromedia does have to name the panels/windows in their applications. Where am I going with this? Server Formats have been around since the dawn of programming, programmers just never had a cool nickname for them.
Normally a programmer would write a custom function that would format a given value/string. On the web, we see functions floating around called FormatCurrency(), or something wild like ConvertToLocalDate(). Well, those functions were all custom to the application they were built for.
When Ultradev came out, most developers didn’t use or know Ultradev. I confused most of my peers when I’d mention the term “Recordset” - others used the term “DataSource.” When I would mention “Repeat Regions,” they wanted an asprin, thinking I was crazy and made up those terms.
Like I said, Macromedia has done a good marketing job of nicknaming elements of web development. This is both good and bad for us. The more Dreamweaver was adopted into production and development enviroments, the more people got used to Macromedias slang and terms. Personally, I like most of the terms they have conjured up, but I also come from a C++ background before Flash or Dreamweaver was invented, so I understand the lingo learning curve when coming to a graphical interface we take for granted – Dreamweaver!
Server Format is just a Macromedia term used within the Dreamweaver/Ultradev environment.
Why are Server Formats so useful?
When designing, you might spend most of your time on how or where something will be displayed. In a normal Dreamweaver workflow, you plan the concept and setup your templates with XHTML, CSS, and cool imagery. Then, off you go, incorporating dynamic data by starting your Recordsets and dragging all your Bindings into the pages made from your templates with probably a few Server Behaviors. We then hit the first reality wall when working with more that just plain text; quickly realizing that some data that’s a date or time comes from the database totally unformatted - how dull and unlegible to the average web surfer!
If you had to code a custom function to alter the display of any price, you’d need to account for many details, like decimals for cents (even if there isn’t any in the data yet), and account for a thousandths seperator (comma, space, or even a dot for some countries). If you use Dreamweaver/Ultradev, you can relax and not need to reach for your aspirin – Server Formats have always been here to save the day!