Re: [SMARTY] function call within function call

Peggy Schatz <[email protected]> Mon, 12 Feb 2007 11:03:06 +0100
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
{checkfield data=$supplier value=$supplier_value
  default=$actype|get_supplier}

did the trick. Great!

An additional question related to the modifier:

In the php-script I have a MDB2-database connection $mdb2.
In modifier function I want to retrieve data from that particular database.
Is there a way of relating to that global variable $mdb2 or
would I have to assign it to smarty or even
open a new database connection?

in modifier.get_supplier.php:

function smarty_modifier_get_supplier($params)
{	
$req = 'SELECT DISTINCT Delivery FROM Lieferant WHERE AC = '. $params . 
' ORDER BY Delivery ASC';
$supplier = & $mdb2->queryCol($req);
if(PEAR::isError($supplier)) {
	die ($supplier->getMessage());
	}
else {
	return $supplier;
	}
}

Peggy

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php