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)}

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 22:13:44
Script start
Timing: Jan 18 2025 22:13:44
Module start 'layout'
Timing: Jan 18 2025 22:13:44
Module start 'content'
Timing: Jan 18 2025 22:13:44
Module end 'content'
Timing: Jan 18 2025 22:13:44
Script end

Main resources:

Total runtime0.0248 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 589.2266152.6094
Module start 'layout' 0.00580.0048 741.835939.4297
Module start 'content' 0.01060.0113 781.265689.3203
Module end 'content' 0.02190.0028 870.585930.3047
Script end 0.0247  900.8906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003012.1716140.0002
Check MTime0.00114.6385140.0001
Mysql Total
Database connection0.00072.970710.0007
Mysqli_queries0.003714.907530.0012
Looping result0.00000.104910.0000
Template Total0.00239.310.0023
Template load0.00135.089810.0013
Template processing0.00104.157310.0010
Override
Cache load0.00093.483610.0009
General
dbfile0.003012.286180.0004
String conversion0.00000.040440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs