Table of Contents

A.1. Taglibs
A.1.1. Tags reference
A.1.2. Function reference

This tag sets a scope variable to a specific value. The variable can be in any scope supported by Phable.

AttributeDescription
var The name of the variable which will hold the specified value.
value The value to store in the variable.
scope Optional variable scope. Default is the page scope.

This tag prints the specified expression. In most cases you don't need this tag because you can use the expression language directly for output but this method is here for compatibility reasons to the JSTL and because you might find it useful to specify a default value which will be used if the expression evaluates to null.

AttributeDescription
value The expression to be evaluated.
default Optional default value which is printed if the specified value evaluates to null.
escapeXml Optional flag to determine if the output should be XML-escaped with entities for the special XML characters <, >, &, ' and ". This flag is true by default

This tag removes the specified variable from a particular scope.

AttributeDescription
var The variable to remove.
scope The scope from which the variable should be removed. If not specified then the variable will be removed only from the page scope.

This tag can be used to build a simple conditional block. If the test expression evaluates to true then the body of this tag is executed. Otherwise it is ignored. Additionaly the result of the test expression can be stored in a scoped variable.

AttributeDescription
test A condition to check. If it evaluates to true then the body is executed. If it evaluates to false then it is ignored.
var Optional variable name which will hold the result of the test expression.
scope Optional scope for the variable. If not specified then the variable is stored in page scope.

With the forEach tag you can iterate over a list of items. This list can be an array or hash map in a scope variable but it can also be a comma separated list of values or it can be constructed with the begin, end and step attributes. The varStatus attribute can be used to get detailed informations about the current iteration run.

The forTokens tag is identical to the forEach tag, the only difference is the additional attribute delims which can be used to define the delimiter characters which separates the specified string into items.

AttributeDescription
items A collection of items to iterate over. Can be a comma separated list of values or an expression which evaluates to a comma separated list of values or to a real array or hash map. If this attribute is not used then the begin, end and step attributes are used to build a list of items.
begin Defines on which index of the items the iteration should begin. Default is 0 which means iteration starts at the beginning of the collection.
end Defines on which index of the items collection the iteration should stop. Default is the end of the items collection.
step Defines in which steps the iteration should be performed. Default is 1 so every item of the collection is included in the iteration.
var Defines the variable name which is set to the current value of the iterated items collection.
varStatus Optional. Defines the variable name which is set to an object which holds detailed informations about the current iteration run. See below.
delimiter Optional. Only valid for the forTokens tag. Defines the delimiter characters that separate the tokens in the string.

The varStatus object contains the following properties:

PropertyDescription
current The current iteration value.
index The current numerical index of the iteration.
first A boolean which is set to true on the first iteration run. Useful to perform special actions for the first item in the collection.
last A boolean which is set to true on the last iteration run. Useful to perform special actions for the last item in the collection.
count An iteration counter. Starts by 0 and is increased on each iteration run.
key The hash key of the current collection item.

bool containsIgnoreCase(subject,  
 search); 
string  subject;
string  search;

Checks if subject contains the substring search. The check is done case-insensitive.

string replace(subject,  
 search,  
 replace); 
string  subject;
string  search;
string  replace;

Replaces all occurrences of search in subject with replace and returns the new string.