SunQuest
 
       ColdFusion
  Home arrow ColdFusion arrow Page 3 - Introduction to ColdFusion Markup Language...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
COLDFUSION

Introduction to ColdFusion Markup Language, concluded
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    2006-01-26

    Table of Contents:
  • Introduction to ColdFusion Markup Language, concluded
  • Query Loop
  • Collection Loop
  • The cfdirectory tag
  • The cffile tag
  • The cfform tag

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Introduction to ColdFusion Markup Language, concluded - Collection Loop


    (Page 3 of 6 )

    The final loop type loops over a collection, or structure. Structures (sometimes referred to as "associative arrays" in other programming languages) are containers for data, and that data is accessed by using what is called a key. In the following example demonstrates looping over a structure named#CGI#and accessing its contents by providing the key to the structure. The CGI structure is a special structure containing run-time information created by the ColdFusion Server. In fact, every "scope" (variable prefix) is exposed to your page as a structure. You can loop over "form," "url," "variables," and so on. For each iteration through the loop, we are setting a variable called#item#that is used to hold the current key. We cover structures in more detail in Chapter 4.

    Enter the following code block into a new Dreamweaver document (colloop.cfm):

    <table>
     
    <cfloop collection="#CGI#" item="item">
        <cfoutput>
         
    <tr>
           
    <td>#item#</td>
           
    <td>#CGI[ item ]#</td>
          </tr>
       
    </cfoutput>
      </cfloop>
    </table>

    Test the document in a browser, and you will see all of the CGI variables in the window, as shown in Figure 3-13. (Only a small sample is shown here.)


    Figure 3-13.   Using a collection loop to output all the CGI variables

    <cfmail>

    We briefly touched on<cfmail>in Chapter 1.This tagis responsible for sending e-mails from within ColdFusion applications to a designated e-mail address. Unlikemailto: linksin HTML, the mail is sent via an SMTP mail server and not the users mail client and mail server. Typically,<cfmail>is used to send news-letters and reminders to users, or error messages to administrators.

    The basic syntax for the<cfmail>tag is as follows (cfmail.cfm):

    <cfmail to="admin@yoursite.com" from=name@visitor.com
            subject="This is the subject">
      The message of the e-mail goes here. </cfmail>

    Several other options for the<cfmail>tag allow you to attach files to the e-mail or specify whether you want to send an e-mail with HTML formatting, and so on. However, we go through only the basic options here. Follow these steps to use this tag in Dreamweaver.

    1. Create a new ColdFusion file in Dreamweaver MX, click on the CFML Advanced tab, and click on the CFMAIL icon, which is the little envelope icon ninth from the left on the toolbar, as shown in Figure 3-14. This will cause the Tag Editor - Cfmail dialog box to open.

                                             



      Figure 3-14.
         The Dreamweaver MX 2004 Insert bar with the advanced CFML functions shown and the cfmail button illustrated 
    2. In the dialog box General tab, you can set the values of the To, From, and Subject attributes by using the appropriate text fields, as shown in Figure 3-15. You can also set CC and BCC addresses.

                                                


      Figure 3-15.   The Tag Editor - Cfmail dialog box's General tab
    3. Next, click on the Message Body tab, fill in the body of the e-mail, and from the drop-down menu select whether you are sending a plain text e-mail or an HTML e-mail.
    4. If you haven't defined a mail server within the ColdFusion Administrator, you can click on the Server Settings section and define your mail server, port, and timeout settings. If you try sending e-mails without defining server settings in the Administrator or within the tag, the e-mail will not be sent and will end up in an undeliverable folder.
    5. Click on the OK button, and the code (as shown previously) is automatically inserted into the Document window.

    More ColdFusion Articles
    More By Apress Publishing


       · This article is an excerpt from the book "ColdFusion Web Development with...
     

    Buy this book now. This article is excerpted from chapter three of the book ColdFusion Web Development with Dreamweaver MX 2004, written by Jen and Peter deHaan et al. (Apress; ISBN: 1590592379). Check it out today at your favorite bookstore. Buy this book now.

    COLDFUSION ARTICLES

    - How to Access a SQL Anywhere Database with C...
    - CFXML: Probing XMLDOM in ColdFusion
    - Creating a Web Service with ColdFusion: the ...
    - CFAjax: What it is and How to Use it
    - Querying SQL 2000 Server from ColdFusion
    - Introduction to ColdFusion Markup Language, ...
    - Introduction to ColdFusion Markup Language
    - Databases and Dreamweaver MX 2004, concluded
    - Databases and Dreamweaver MX 2004
    - Welcome to Coldfusion MX 6.1, concluded
    - Welcome to Coldfusion MX 6.1
    - What You Must Know About ColdFusion Flow-Con...
    - What You Must Know About Operators in ColdFu...
    - Everything You Must Know About ColdFusion Va...
    - My First Application on ColdFusion MX Server







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway