[ic] Accessing variables defined in the catalog.cfg

Ethan Rowe ethan at endpoint.com
Mon Oct 25 13:17:53 EDT 2004

Jon Jensen wrote:

>On Mon, 25 Oct 2004, Boyer, Jim wrote:
>>I know this should be simple but I sure can't figure it out.  I am
>>setting a variable in my catalog.cfg as such:
>>Variable WINHOST  True
>>I am not having success reading this variable in the receipt.html page.
>>I can print out the value of the variable, but I want to make a decision
>>on the value of the variable.  I have tried the following but without
>>success.  I have not found examples of this in the docs, but I could
>>have easily missed them.
>>[if __WINHOST__ ]
>>[if __WINHOST__ eq True]
>>[if @_WINHOST_@ eq True]
>>[if [var WINHOST] eq True]
>>What am I doing wrong with this simple test?
>[if variable WINHOST]
For purpose of clarity: the [if] tag needs some kind of "type" passed to 
it so it knows the space from which to draw the values it will be 
testing.  For example:
[if cgi testme eq Me]

The "type" parameter is the first parameter by default (when you are 
using unnamed parameters).  Thus, the "type" of the above [if...] is 
"cgi".  Interchange will look at the value of CGI variable "testme" and 
result in TRUE if that variable is equal to the literal "Me".

When you want to get into fancier tests relying on the interpolation of 
other values, you will either need to use a type=explicit if, as shown 
in Ed LaFrance's response to your post, or you'll need to expliciitly 
name all the arguments and wrap whatever requires interpolation in some 
kind of quote (single quote, double-quote, or pipes).  For instance:
[if type=scratch term=junk op=eq compare=|[cgi testme]|]

This will result in TRUE if the scratch variable "junk" ("type=scratch" 
and "term=junk") is equal ("op=eq") to the value held within the cgi 
variable "testme" ("compare=|[cgi testme]|").

Finally, my understanding is that the variable tokens (@@SOMETHING@@, 
__SOMETHING__) are interpolated in an earlier pass than the usual ITL 
tags.  This can complicate things sometimes.

Hope this helps.

Ethan Rowe
End Point Corporation
ethan at endpoint.com

More information about the interchange-users mailing list