1 / 45

Chapter 27 – Macromedia ColdFusion MX

Chapter 27 – Macromedia ColdFusion MX. Outline 27.1 Introduction 27.2 Simple ColdFusion Example: Clock 27.3 Using Variables and Expressions 27.4 Variable Scoping 27.5 Form Processing 27.6 Creating a Data Source Name 27.7 Bookstore Case Study: Interface and Database

lindsey
Download Presentation

Chapter 27 – Macromedia ColdFusion MX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 27 – Macromedia ColdFusion MX Outline 27.1 Introduction 27.2 Simple ColdFusion Example: Clock 27.3 Using Variables and Expressions 27.4 Variable Scoping 27.5 Form Processing 27.6 Creating a Data Source Name 27.7 Bookstore Case Study: Interface and Database 27.8 Bookstore Case Study: Shopping Cart 27.9 Advanced Topics for ColdFusion Developers 27.10 Web Resources

  2. Objectives • In this lesson, you will learn: • To create basic ColdFusion templates. • To use ColdFusion Markup Language tags and functions to add dynamic functionality to Web pages. • To use information collected from Web forms. • To create a database-driven bookstore application. • To create a shopping cart for the bookstore that follows a user through the site.

  3. 27.1  Introduction • ColdFusion • Widely used server-side markup language • Developed by Allaire • ColdFusion Markup Language (CFML) • Based around a set of tags that work like XHTML tags • Supports XML, ColdFusion Components and Web services • Saved with a .cfm extension • ColdFusion template

  4. 27.2  Simple ColdFusion Example: Clock • CFML comment • <!--- CFML Comment ---> • cfoutput tag • Variables and functions are enclosed in #’s • dateFormat • timeFormat • now

  5. clock.cfm(1 of 2)

  6. clock.cfm(2 of 2)

  7. Generated XHTML code(1 of 2)

  8. Generated XHTML code(2 of 2)

  9. 27.3  Using Variables and Expressions • CFML also supports creating and manipulating variables

  10. variables.cfm(1 of 2)

  11. variables.cfm(2 of 2)

  12. 27.3.1 Variables and Data Types • Variables much like variables in most other languages • cfset • Does not produce any output • No close tag

  13. 27.3.1 Variables and Data Types

  14. 27.3.2 Expressions and Operators

  15. 27.4  Variable Scoping • Scope • Defines from where the variable can be accessed • Refers to the named space where the variable is stored • cfif tag • Behaves just like if statements in other languages • cfelseif • cdelse • isDefined function • Returns true or false • NOT operator • Reverses the truth or falsity of entire expression

  16. 27.4  Variable Scoping

  17. name.cfm(1 of 2)

  18. name.cfm(2 of 2)

  19. 27.5  Form Processing • form variable scope • Gather information from the user • isNumeric function • Similar to isDefined function • Returns boolean value • Returns true if parameter is number • False otherwise

  20. form.html(1 of 2)

  21. form.html(2 of 2)

  22. form_process.cfm(1 of 2)

  23. form_process.cfm(2 of 2)

  24. 27.6  Creating a Data Source Name Fig. 27.10 Data source registration in the ColdFusion Administrator.

  25. 27.7  Bookstore Case Study: Interface and Database • cfquery tag • cflocation tag • Redirects the user to another CFML template • cfabort tag • Instructs CFML interpreter to stop and not finish processing page • cfloop tag • Outputs the code between its opening and closing tags once

  26. booklist.cfm(1 of 3)

  27. booklist.cfm(2 of 3)

  28. booklist.cfm(3 of 3)

  29. bookinfo.cfm(1 of 5)

  30. bookinfo.cfm(2 of 5)

  31. bookinfo.cfm(3 of 5)

  32. bookinfo.cfm(4 of 5)

  33. bookinfo.cfm(5 of 5)

  34. 27.8  Bookstore Case Study: Shopping Cart • cfapplication tag • Access the variable scopes related to applications • client variables • Can be stored as cookies on user’s computer or in server’s registery • session variables • Store contents of user’s shopping cart as user makes selections • application variables

  35. Application.cfm(1 of 1)

  36. shoppingcart.cfm(1 of 3)

  37. shoppingcart.cfm(2 of 3)

  38. shoppingcart.cfm(3 of 3)

  39. 27.9  Advanced Topics for ColdFusion Developers • Ability to create custom tags and user-defined functions • Set of built-in CFML tags for working with XML and for interacting with Web services

  40. 27.10  Web Resources • www.macromedia.com/software/coldfusion • www.macromedia.com/support/coldfusion/documentation.html • www.macromedia.com/cfusion/exchange/index.cfm?view=sn130 • www.forta.com • www.sys-con.com/coldfusion

More Related