<{$variable|func:$(0),param1,param2,...}> is available(we can use this is array loop)
description
$variable
the variable we want to operate with.e.g. we assign a variable in the controller "$this->assign('variable',$variable)" or we assign an array
$this->assign('arr',array('one','two','three'));
then we can use it in the template
eg.tpl
<{loop $arr $variable}>
<{$variable|substr:$(0),1,2}>
<{ /loop }>
|
this is the delimiter between the target variable and function
func
the function we want to effect the $variable.
we can use an internal function like substr() or we can use a outer function,for example,we define a function in /commons/functions.inc.php
function color($tar,$color){
return ''.$tar.'';
}
the most important thing is that the function is available(have been included)
:
the delimiter between function and parameters
$(0)
this is the placeholder of the $variable(position is not fixed,we can place it any where depending on the need).that's to say,it's value is $variable
one thing we should notice is,we should not enclose it with single or double quotes
param1,param2,...
the function parameters list.
if it is a string,single or double quote are encouraged