Download presentation
Presentation is loading. Please wait.
1
Cold Fusion Tutorial Mohammad Shamma SIMS 213 Spring 1999
2
Cold Fusion Tutorial Brief overview of CF Three-tiered architecture Building CF queries Specifying CF query output Building CF data input forms Inserting data from a CF form A sample CF database “drill-down” application
3
Cold Fusion Architecture
4
As shown in the previous slide, the Cold Fusion Application Server (CFAS) processes “.cfm” templates by parsing only CFML (Cold Fusion Markup Language) tags within the template. CFML looks almost exactly like HTML which makes building “.cfm” templates easier for user who are familiar with HTML.
5
Intro to CFML This is an example of CFML query that produces a student list. SELECT studentID, studentName FROM students The required attributes for are “name” and “datasource.” “Name” refers to an arbitrary name so that you can refer to this query in and “datasource” refers to the unique datasource name specified in the ODBC Administrator tool in Microsoft Windows. For further informaiton on ODBC please see FAQ at (http://www.roth.net/odbc/odbcfaq.htm).
6
CFML (cont’d) Next, the tag is required to display the output of a particular. SELECT studentID, studentName FROM students #studentID# -- #studentName# Although the tags do not have to be placed within the tags, the must be placed within these tags.
7
CFML The following output will be displayed with whatever HTML formatting is inserted inside the tags. So if we wanted to apply HTML formatting to one of the output fields in the previous example, we would do so like this: #studentID# -- #studentName# The tags around the #studentID# output field will apply a “Bold” font style to that particular field.
8
What would this “.cfm” file look like? SELECT studentID, studentName FROM students CF Query example #studentID# -- #studentName# Once finished the “.cfm” file would look like this.
9
CF Data Input Forms A typical way to build a CF based data input form is to create a typical HTML form and assign the appropriate field names as attributes within your form. Ex. *Notice that the names of these two inputs correspond to the field names used in the previous example.
10
CF Data Input Forms Next you need to specify the form action, which in this case is the page that will insert the data from the form into the “student_db” datasource.
11
Inserting data from a form. The tag is an easy way to insert data from a form into a database table. The following is an example of what would be placed at the top of the “addStudent.cfm” action template: *Note that we are using the same datasource and that that table to be updated is specified as well.
12
Sample CFML files Along with these notes are a set of “.cfm” files that read and display simple data from a datasource, add data to that datasource and perform complex searches to “drill- down” into that datasource. The datasource for these files is a Microsoft Access database file called (tutorial.mdb).
13
CFML Sample files The file “grade_report.cfm” produces a list of students and their grades from particular courses. The files “addStudentGrade_EntryForm.cfm” and “addStudentgrade_EntryAction.cfm” allow data to be inserted into the database.
14
CFML Sample files Finally the last set of files allow you to build complex data “drill-down” applications to the database: –studentsearch_Search.cfm –studentsearch_Result.cfm –studentsearch_Detail.cfm –studentsearch_AppendCriteria.cfm
15
More on Cold Fusion If you want to know more about Cold Fusion (http://www.allaire.com) Further documentation can be viewed from (http://www.allaire.com/Documents/cf4docs.cfm)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.