docs.roxen.comView this page in a printer friendly mode
DocsRoxenWebServer 4.5Web Developer ManualVariable Tags
Copyright  2012, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com
 DEMO  DOCS  PIKE
 COMMUNITY  DOWNLOAD
www.roxen.com



<append>
<copy-scope>
<dec>
<define>
<inc>
<insert>
<insert cached-href>
<insert file>
<insert href>
<insert realfile>
<insert scopes>
<insert variable>
<insert variables>
<roxen-automatic-charset-variable>
<scope>
<set>
<sprintf>
<sscanf>
<undefine>
<unset>
<use>
<vform>

<set/> or <set></set>

Provided by module: Tags: RXML 2 tags

Sets a variable in any scope that isn't read-only.


<set variable='var.language'>Pike</set>

Attributes

variable="string"

The name of the variable.


<set variable='var.foo' value='bar'/>

value="string"

The value the variable should have.


expr="string"

An expression whose evaluated value the variable should have.

Available arithmetic operators are +, -, *, / and % (modulo). Available relational operators are <, >, ==, !=, <= and >=. Available bitwise operators are &, | and ^, representing AND, OR and XOR. Available boolean operators are && and ||, working as the pike AND and OR. Subexpressions can be surrounded by ( and ).

The size of a string or array may be retrieved with sizeof(var.something).

The function pow(x,y) can be used for calculating the value x raised to the specified power y.

Numbers can be represented as decimal integers when numbers are written out as normal, e.g. "42". Numbers can also be written as hexadecimal numbers when precedeed with "0x", as octal numbers when precedeed with "0" and as binary number when precedeed with "0b". Numbers can also be represented as floating point numbers, e.g. "1.45" or "1.6E5". Numbers can be converted between floats and integers by using the cast operators "(float)" and "(int)".


(int)3.14

RXML variables may be referenced with the syntax "scope.name". Note that they are not written as entity references (i.e. without the surrounding & and ;). If they are written that way then their values will be substituted into the expression before it is parsed, which can lead to strange parsing effects.

A common problem when dealing with variables from forms is that a variable might be empty or a non-numeric string. To ensure that a value is produced the special functions INT and FLOAT may be used. In the expression "INT(form.num)+1" the INT-function will produce some integer regardless what the form variable contains, thereby preventing errors in the expression.


from="string"

The name of another variable that the value should be copied from.


split="string"

The value will be splitted by this string into an array.

If none of the above attributes are specified, the variable is unset. If debug is currently on, more specific debug information is provided if the operation failed. See also: <append> and <debug>.