[SMARTY] database connection within modifier function

Peggy Schatz <[email protected]> Tue, 13 Feb 2007 12:10:30 +0100
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
Hello again ;o)

how would one relate to an existing database connection (PEAR::MDB2) 
within a plugin or modifier function?
The database connection is included as 'standard_db.inc.php'  in 
'standard.php' which finally displays the template containing the plugin.

Is there a way of directly relating to the global variable $mdb2 within 
a modifier-function or would I have
- to fetch 'standard_db.inc.php',
- define $mdb2 as constant (using $smarty.const),
- use config file,
- assign it to smarty or even
- open a new database connection?


in modifier.get_supplier.php:

function smarty_modifier_get_supplier($params)
{
...
$supplier = & $mdb2->queryCol($req);
...
}


Thanks in advance,
Peggy

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