For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > February 2007 > Re: [SMARTY] function call within function call









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [SMARTY] function call within function call
Peggy Schatz

2007-02-12, 4:19 am

{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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com