Register function $smarty->register_function('len',"SmartyLen"); Template call {len text="under test" length="1"} //Note that text and length here are actually two parameters in the function. The parameters of the function must be the same as the internal variable name of the function. In fact, they are passed back is an array, use extract($params); in the function to import the variables in the array into the current symbol table. |