Forums / Developer / A way to get module_result ALONE

A way to get module_result ALONE

Author Message

Gabriel Ambuehl

Wednesday 07 December 2005 7:48:40 am

Is there any way (aside of using a page layout that has only {module_result} in it which is problematical as the same layout will be used in every link ) to fetch ONLY the module_result, e.g. the full view of a content object.

I want to fetch content object views for AJAX and I only need the content, not all the pagelayout it's usually wrapped in...

Visit http://triligon.org

Paul Forsyth

Wednesday 07 December 2005 7:55:03 am

If you are in PHP could you not just use:

$tpl =& templateInit();
$tpl->fetch(<your tpl>);

to get just the template result? Or maybe make a small function to do this for you?

Clemens T

Wednesday 07 December 2005 8:28:52 am

Do something like this:

$Result = array();
$Result['content'] = & $tpl->fetch( 'design:myModule/myview.tpl' );
$Result['path'] = array( array( 'url' => 'myModule/myView/',
                                'text' => 'my View') );
$Result['pagelayout'] = false;

Hopefully this will help you.
Greets,
Clemens

Gabriel Ambuehl

Friday 09 December 2005 2:38:06 am

This is how I finally did it (to fetch the full view of a content node):

<?php
include_once( 'kernel/classes/ezcontentobject.php' );
include_once( 'kernel/classes/ezcontentobjecttreenode.php' );
include_once( 'kernel/common/template.php' );
include_once( 'lib/ezutils/classes/ezexecution.php' );

$nodeID = false;
$http =& eZHTTPTool::instance();
$module =& $Params["Module"];
$originalParameters=$module->OriginalUnorderedParameters;



if (array_key_exists('nodeID', $originalParameters) ) {
    $nodeID = $originalParameters['nodeID'];
}

if ( !( $nodeID) ) {
    eZDebug::writeError( "nodeid not set as param");
    return $module->handleError( EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel' );
}



$node =& eZContentObjectTreeNode::fetch( $nodeID);
if ( is_object( $node ) )
        {

            
            
            
            $tpl =& templateInit();
            $tpl->setVariable( 'node', $node);
            $tpl->setVariable( 'nodeid', $nodeID );
            
            
            echo ($tpl->fetch( "design:resultonly.tpl" ));
            eZExecution::cleanExit();
        }
else {
    return $module->handleError( EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel' );
}

?>

whereas resultonly.tpl simply contains an appropriate node_view_gui call.

But thanks for your inputs ;)

Visit http://triligon.org

eZ debug

Timing: Jan 31 2025 06:26:05
Script start
Timing: Jan 31 2025 06:26:05
Module start 'content'
Timing: Jan 31 2025 06:26:05
Module end 'content'
Timing: Jan 31 2025 06:26:06
Script end

Main resources:

Total runtime0.1851 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 587.9375180.8281
Module start 'content' 0.00540.0068 768.765693.8984
Module end 'content' 0.01220.1728 862.6641522.0469
Script end 0.1850  1,384.7109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00341.8204200.0002
Check MTime0.00150.8015200.0001
Mysql Total
Database connection0.00070.356610.0007
Mysqli_queries0.133372.01811410.0009
Looping result0.00140.73471390.0000
Template Total0.172493.210.1724
Template load0.00070.371110.0007
Template processing0.171792.798510.1717
Override
Cache load0.00050.262710.0005
Sytem overhead
Fetch class attribute can translate value0.00080.407010.0008
XML
Image XML parsing0.00040.238310.0004
General
dbfile0.00945.0817200.0005
String conversion0.00000.003330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

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

Time used to render debug report: 0.0002 secs