1 / 18

Introduction to ColdFusion

Introduction to ColdFusion. By Tom Dubeck. Overview. What is ColdFusion? How does it compare to other scripts? Some example code. Why you might want to use it. Installing ColdFusion. Controlling ColdFusion. What is ColdFusion?.

nardo
Télécharger la présentation

Introduction to ColdFusion

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. Introduction to ColdFusion By Tom Dubeck

  2. Overview • What is ColdFusion? • How does it compare to other scripts? • Some example code. • Why you might want to use it. • Installing ColdFusion. • Controlling ColdFusion.

  3. What is ColdFusion? • ColdFusion != Cold Fusion, it will not power your computer or win you a Nobel Prize in Physics • It will however, let you write powerful web applications relatively quick and straightforward as compared to some other web scripts.

  4. Other language Comparisons Perl • Interpreted on a character basis • Any shared data must go through hidden HTML field or manually created cookies. • Both HTML and Headers must be spelt out using Print commands • Syntax similar to C++ but with a lot more punctuation characters in weird places. • Object Oriented?

  5. Other Language ComparisonASP/VBscipt • Interpreted on a Character basis • Pages are loaded individually, but can be easily connected through Session and Application variables. • ASP code is inserted in between normal HTML with special <% %> tags (much like JSP). • Very different Syntax than C/Perl/etc, but very human readable. • Barely Object Oriented

  6. Other Language ComparisonColdFusion • Interpreted on a Tag basis. Also administered by local Admin page. • Like ASP, has Session, Application, and other scopes that can share information from page to page. • Each Logic control or Data structure is represented by its own HTML/XML-ish tag, highly intermingled. • Structures and Custom tags, not quite objects

  7. Source Comparison

  8. Tag based Code • <cfset> to declare/set variables • <cfloop> for any kind of loop, index/while/container • <cfoutput> for both plain printing and containers/lists • <cfquery> for database access • <cfparam> for easy form field or argument validation and access

  9. Operators • In CFML, <>= already used in tags. • = - is, equal, or eq • != - is not, not equal ne • ><>=- gt, lt, greater than or equal, gte • XOR, EQV, IMP,^ and MOD supported as well.

  10. Make your own tags, kind of like OOP • Define a template MyClass.cfm • Use <cfparam> to take in attributes • Use thistag.executionmode to set behaviors for endtags • Tag is called<cf_MyClass>.

  11. Why ColdFusion? • Very high interactivity and support with Macromedia products include Flash and Dreamweaver. • Verity Search Engine takes all the work out of full text searches. • Admin page keeps important system settings (Databases, error handling) standardized between pages and hidden from those that don’t need to know. • Very powerful query control • Easy to use variable validation.

  12. ColdFusion in ActionVerity Search through Database • <cfquery name="descriptions" dataSource=“Store"> Select ItemNumber, Description From MainInventory </cfquery> • <cfparam name=“txt" default=“nothing"> • <cfindex collection="ProductSearch" body="Description" key="ItemNumber" query="descriptions"> • <cfsearch name="Products" collection="ProductSearch" criteria="#txt#"> • <cfquery name=“results" datasource=“Store" dbtype="ODBC"> Select * From Products Where key in (#ValueList(Products.Key)#) </cfquery>

  13. ColdFusion in ActionQuery of Queries • <cfquery name=“alldata" dataSource=“Store"> Select * From MainInventory </cfquery> • <cfquery name=“GetByType" dbtype=“query"> Select ItemNumber, Description From alldata Where type=“Electronics” </cfquery>

  14. Query of Queries • Uses the Query object instead of the database. • Greate for narrowing results or re-ordering. • Although it supports it, not a good idea to join.

  15. In case you don’t like CFML • <cfscript> tag- works like <script> tag for JavaScript or <%%> for *SP. • Supports for, while, do while loops identical to JavaScript. • Function to declare functions, var to declare varibles, return anything you want. In other words, just like JavaScript. • No print command, have to return a string and <cfoutput>

  16. Installing ColdFusion • Can be done with or without a previous Web server. • Can get a free developer’s version to tinker with on your machine from www.macromedia.com. • Default settings generally work.

  17. ColdFusion Admin • Conveniant place to control your Data Sources, Verity Collections, System settings, and Debug/Error handling.

  18. ColdFusion Resources • Macromedia’s Developers’ Forum • Various online tutorials • Various books

More Related