Note that you could also use [text multi=t] to set the string of colors in one shot. But I find them more readable when stacked as in the above example.

the name of a text variable is limited to 49 characters.

Text variables can be numbers, and they can be used in math equations. A number is still a number, as long as it isn't tainted with non-numerical characters (i.e. 24a would not work as a number).

Parameters

Description

multi

(optional) "T" or "F". Allows you to assign more than one text variable in a single context. [text multi=T]var1=Joe&var2=Fred[/text] simultaneously assigns the two variables. (There is no need to use multi=f for single variables.)

show

(optional) "T" or "F". Default behavior is to hide the value when assigning to a text variable (the opposite of a math variable). If you want the value to be shown at the same time it is assigned to a variable, you may set Show=T. But if you set multi=T at the same time, then no values will be displayed. (There is no reason to ever use show=f, as this is default behavior.)

secure

(optional) "T" or "F". Default is "T". Setting secure=F makes the text variable overrideable by incoming form variables. This is not recommended, and the default behavior is secure. Sometimes you might want a form on the preceding page to override an embedded variable, and in this case, you'd use secure=f for the embedded text contect. However, this also makes it possible for a visitor to type in the name=value pair in the URL, which would override the embedded one. So use this with caution, only if no harm could result.

WebDNA expects anything after the = to be part of the set variable. If the value also contains an =, this will not mess anything up, and in fact, it is not uncommon to set a variable consisting of a string such as db=somedb.db&eqsomefielddatarq=value&somefieldsort=1, to be used in a search context later. Something like this would of course not work in a [text multi=t] situation.

If you forget to put the closing [/text] tag, then the entire rest of the page will not display, being assumed to be part of the variable.

Historical behavior: Originally, a text variable had to be retrieved by using this format: [text]variablename[/text]. It will still work this way. If you inadvertantly code something without an = sign, nothing bad will happen; the seemingly unknown variable will simply resolve to blank. This behavior can be used to your advantage if you sometimes set a variable, and sometimes do not (on the same page) depending on the condition. When retrieving, if the variable is unknown, you would get the variable name surrounded by square brackets, but merely a blank if using the old syntax.

All you ever wanted to know about Variable Types

So, do you access all variable values using the syntax [XXX]? You may want to reconsider it.. or at least consider further this usage. This is because variables that have the same name, can have different values in WebDNA.. just as in C++ and other languages.

So does WebDNA have a preference on what type it displays as default? Yes. below is the code that you can paste into your own blank template and save to a WebDNA server to test it yourself!

<!--HAS_WEBDNA_TAGS-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"><title>Variables</title><meta name="generator" content="BBEdit 7.0.1"></head><body><b>Can a variable be named the same and have different values?</b><hr>

Here is a variable named <b>"myVar"</b> that is of the types"math" and "text". (see at bottom for "form")<br><br>

What about Form Variables?Formvariables work in the same way. Try appending to this URL"?myVar=FormVar" and see what you get.

There are a few 'reserved' scope names:

"global" - refers to the 'normal/secure' template variable space. "local" - When used inside of a function or scope context, refers to the variable space associated with the current function or scope. "insecure" - Refers to the 'insecure' template variable space (this space also includes HTML form variables).