Send Page Url to A Friend
XML Tutorial
This is a method for reading in variables and constants from an XML file. In this example, we are reading them in to the application scope. This can be useful for sharing variables across applications or servers, and to keep things organized.
Take the following XML file with some application constants.
<myApplication>
<dsn>my_dsn</dsn>
<docRoot>j:\cfusionmx\wwwroot\my_app</docRoot>
</myApplication>
Take the following Application.cfm (set the XMLPath to be the location of your XML file):
<cfapplication name="myApp" applicationtimeout="20">
<cfif not(isDefined("application.vars.dsn")) or isDefined("url.flush")>
<cfset XMLpath =U:\CFusionMX\wwwroot\tutorial\myXMLFile.xml">
<cffile action="read" file="#XMLpath#" variable="x">
<cfset x = xmlparse(x)>
<cfset var_array="#x.myApplication.xmlchildren#">
<cfloop from="1" to="#arraylen(var_array)#" index="i">
<cfset var_name = var_array[i].xmlname>
<cfset "application.vars.#var_name#" = #var_array[i].xmltext#>
</cfloop>
</cfif>
If application.vars.dsn is not defined or we pass in url.flush to a page in our application, the code will parse the XML file and assign application variables accordingly. The url.flush mechanism is a handy way to reflect changes in the XML file without waiting for the application to timeout or a server reboot.
If you <cfdump var="#application.vars#">, you will see the two application variables defined in the XML file.
-
Advanced Form Checking
This tutorial places the submitted form values into a session, than error checks them. If there is an error it will show the form again with the previous values the user entered pre-entered in the form. It will also tell the user which form fields had errors in them.
Author: Redmanz
Views: 38,547
Posted Date: Tuesday, November 26, 2002
-
Duplicate Data Checking
This tutorial uses a opt-in mailing list as an example. After the end-user enters their information the information goes to an action page which checks to see if the users email address already exists in the database. If it exists it lets them know and will not enter the duplicate data, if it does not exist it enters them into the mailing list.
Author: Redmanz
Views: 23,720
Posted Date: Monday, December 9, 2002
-
Dynamic Sorting
This tutorial shows the basics of allowing your end-users to dynamically sort the order in which they view your records. You can have as many sort orders as you have fields viewed!
Author: Redmanz
Views: 22,176
Posted Date: Thursday, December 5, 2002
-
Guest Book (Part 1 / 2)
This Guestbook is part one of a two part tutorial. This part deals with the guest book itself the second part will build a administration area for this guestbook. The guest book submits to two tables in a mySql database the first table being for the actual guest book display template and the second table to be used for an opt-in mailing list.
Author: Redmanz
Views: 34,132
Posted Date: Friday, December 13, 2002
-
Guest Book (Part 2 / 2)
This is part two of my guestbook tutorial, in part one we created the actual guestbook. In this part we will now look at creating an administration area for our guestbook. In this admin area we will be able to edit and delete guestbook entries as well as add or delete administrators.
Author: Redmanz
Views: 23,121
Posted Date: Saturday, December 21, 2002
-
Send Page Url to A Friend
A simple script where a user can click a link that will take the current templates url and pass it to a email form which they can than fill in with their friends emails addresses to send their friends your site address.
Author: Redmanz
Views: 27,738
Posted Date: Saturday, November 23, 2002
-
Show Source to Friends
Not really a tutorial but some code to help you solve programming problems by showing your code online to your friends or associates.
Author: Redmanz
Views: 14,493
Posted Date: Tuesday, February 18, 2003