Introducing ColdFusion Markup Language

 < Day Day Up > 



When you open the source of a CGI program, such as mailto, in a text editor, you see a lot of programming code that's likely to be unfamiliar. Even diehard Perl programmers admit that their language is one of the least intuitive for nontechies to understand. In contrast, when you open the source of a ColdFusion template in a text editor (or Dreamweaver's code view), you see code that looks like a standard HTML page containing familiar elements, such as HTML tags, and additional elements similar to those shown in the sample page Listing 47-1.

Listing 47-1: A Sample ColdFusion Template Containing HTML and CFML Tags

start example
 <cfmail from="admin@somedomain.com" to="jim@anotherdomain.com"  subject="User Info Request">      Hi Jim;            A user has requested information from the Web site:          Name: #form.firstname# #form.lastname#      Email: #form.email# </cfmail>     <html> <head>      <title>Your Form Has Been Submitted</title> </head>     <body> <h1>Your Form Has Been Submitted</h1>     <cfoutput>      <p>Thanks, #form.firstname# #form.lastname# for requesting more  information. Mail has been sent to our site administrator announcing  your interest. You will be contacted shortly at the e-mail address you  supplied, #form.email#.</p> </cfoutput>     <cfif form.registerdrawing is 'yes'>      <p>In addition, you have been entered in our site drawing.</p> <cfelse>      <p>You have chosen not to register for our drawing. Thanks for  visiting our site.</p> </cfif>     </body> </html>
end example

CFML is a tag-based language, which is why even nonprogrammers usually take to it quickly. Like HTML tags, most CFML tags have an opening tag, such as <cfoutput>, and a closing tag, such as </cfoutput>. Text or other elements appearing within a set of tags inherit properties assigned to the tag. Even without prior knowledge of programming or ColdFusion, you can open a template like Listing 47-1 and quickly get an idea of what's going on. That's one of the main attractions of ColdFusion, and one of the features nonprogramming designers find most endearing.



 < Day Day Up > 



Macromedia Studio MX Bible
Macromedia Studio MX Bible
ISBN: 0764525239
EAN: 2147483647
Year: 2003
Pages: 491

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net