The primary distinguishing feature of ColdFusion is its associated scripting language, ColdFusion Markup Language (CFML), which compares to JSP, ASP.NET, or PHP and resembles HTML in syntax. "ColdFusion" is often used synonymously with "CFML", but it should be noted that there are additional CFML application servers besides ColdFusion, and that ColdFusion supports programming languages other than CFML, such as server-side Actionscript and embedded scripts that can be written in a JavaScript-like language, known as CFScript.
One of the great things about Coldfusion, PHP or any other web language is that you can set a variable, better yet a GLOBAL variable that can be referenced across many pages. This makes life easier since if you want to make a change to site or directory, you only have to change the code in one place.
So what happens when you want to use a variable in a CFIF statment? It doesn't work, or at least not as you think it would.
In this example lets assume that I want to use a variable from my cfapplication.cfm file inside my CFIF statements. I want to have image displayed at the top of the page that says "Administrators" for the guys in the Admin team and "Users" for the folks that are in the user team. First I need to set the variable in the cfapplication.cfm file that gets the cookie.userid I have set. If you don't know how to set a cookie in coldfusion check out this link Abode KB.
Now all I have to do in the actual coldfusion file is call that global variable like this:
If the cookie login thing is throwing you off, here is a more simple example
That is how you can use a variable in a coldfusion cfif statement. Feel free to leave questions below
Feel free to leave a comment or question
Code block comments
2010-03-19
Added a code block for comments
Windows 7 Items
2009-09-24
new info on windows 7
Snort on Debain Lenny
2009-08-19
Installing snort+PGSQL on Debian