Re: [SMARTY] function call within function call

From: Date: Fri, 09 Feb 2007 18:58:34 +0000
Subject: Re: [SMARTY] function call within function call
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13677@lists.php.net to get a copy of this message
Peggy Schatz wrote: > Hello, > > I'm looking for possibly combining two plugins. > > Depending on the assigned variable {$actype} I want to retrieve related > data from a database by using function {get_supplier} and use the result > as parameter for function {checkfield} > > *** > The way it worked before (all supplier data in array and assigned as > $supplier_default): > > {checkfield data=$supplier value=$supplier_value > default=$supplier_default.$actype} > > *** > The way I'd rather have it to work (but it doesn't): > > {checkfield data=$supplier value=$supplier_value > default=get_supplier($actype)} I don't think that will work - then iagain it wouldn't be the first time I was wrong ... why not do this: {checkfield data=$supplier value=$supplier_value actype=$actype} function smarty_function_checkfield($params, &$smarty) { // check args // load get_supplier plugin $default = smarty_function_get_supplier($params, $smarty); // more magic } > > function smarty_function_get_supplier($params, &$smarty) > { > /* database query */ > $res=array(1,2,3); > return $res; > } > > *** > Both functions are named right (function.checkfield.php, > function.get_supplier.php) in the assigned plugins-directory. > > Is a function call within a function call possible? What'd be the proper > syntax to achieve the desired? > > Thanks and greetings, > Peggy >

« previous php.smarty.general (#13677) next »