Forums / Developer / Where's my result?

Where's my result?

Author Message

Aleksander Lech

Sunday 14 August 2005 10:53:18 am

hello,
here's part of my custom extension code:

include_once( 'kernel/common/template.php' );

$tpl =& templateInit();

$Result = array();
$Result['content'] =& $tpl->fetch( 'design:mymod/overview.tpl' );
$Result['path'] = array( array( 'url' => false,
                                'text' => 'MyMod' ) );
                                

   include_once( 'lib/ezdb/classes/ezdb.php' );  
   $db =& eZDB::instance();
   $Result['wynik'] =& $db->arrayQuery( 'SELECT * FROM firma WHERE id<2',
                            array( 'offset' => 0, 'limit' => 10 ) );


Result of the query is in $Result['wynik'] array. How to get it from there and use it in template?

Regards
Aleksander

Gabriel R.

Sunday 14 August 2005 11:39:58 am

use the template 'setVariable' function:

php extension code

...

$db =& eZDB::instance();
   $wynik =& $db->arrayQuery( 'SELECT * FROM firma WHERE id<2',
                            array( 'offset' => 0, 'limit' => 10 ) );

$tpl->setVariable( 'wynik', $wynik );

template example

my result: {$wynik|attribute(show)}