 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
nitrox20 Smarty n00b
Joined: 29 Mar 2010 Posts: 2
|
Posted: Mon Mar 29, 2010 3:10 pm Post subject: plugin with adodb |
|
|
Hi, i tryed to code a function/plugin for smarty but get an error: | Code: | | Fatal error: Call to a member function execute() on a non-object in /home/page/public_html/include/smarty/plugins/function.products.php on line 33 | . This is the function.products.php: | Code: | function smarty_function_products($params, &$smarty) {
if(!isset($params['group'])) {
$smarty->trigger_error("no product group found");
return;
}
$group = $params['group'];
$sql = "SELECT * FROM products WHERE type = '$group'";
$rs = $conn->execute($sql);
$product = $rs->getrows();
return $product;
} | im using adodb. and this is how i call my function: | Code: | | {products group="cars"} | hope somebody can give me hint what im doing wrong. |
|
| Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 4178 Location: Hamburg / Germany
|
Posted: Mon Mar 29, 2010 3:54 pm Post subject: |
|
|
Your objects $conn and $rs are not defined in the context of your plugin.
You could make them available by defining them as global variables. |
|
| Back to top |
|
nitrox20 Smarty n00b
Joined: 29 Mar 2010 Posts: 2
|
Posted: Tue Mar 30, 2010 6:35 am Post subject: |
|
|
| danke/thanks! |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|