Forums / Developer / problem including page_toppath template

problem including page_toppath template

Author Message

zaxofeel .v

Wednesday 11 April 2007 8:55:12 am

hi all
I have a strange problem, when I include the page_toppath template within the pagelayout it works fine and the path is displayed perfectly
but I don't want to include the path in the pagelayout, i inluded it in some templates but it is not working, i think the $module_result.path is empty
does anybody know why would it be working with the pagelayout only?

Michael Lee

Wednesday 11 April 2007 9:18:48 am

Hi Zaxofeel,
The $module_result variable can only be used in "pagelayout". In fact, each eZ Publish module will set its module_result variables in an array called $Result and eZ Publish will set $Result as a template variable in "pagelayout"

Michael Lee | Managing Director | ZerusTech Ltd | www.zerustech.com

Skype: zerustech

zaxofeel .v

Wednesday 11 April 2007 9:26:50 am

Thanks lee for the useful info :)
so let's change the question,
how can I modify the
{section loop=$module_result.path} to let it work from an template not only the pagelayout?
i thought about a fetch function but actually i reached nothing.
any suggetions?

Michael Lee

Thursday 12 April 2007 1:57:31 am

I'm afraid that's not quite possible, because eZ Publish works as the follows:
1. user access a URL
2. eZ Publish parses the URL and determines which module and view to execute in "index.php"
3. eZ Publish executes the module/view
4. The view script sets several tpl variables to a tpl, fetches the tpl, set the tpl result as $module_result.content and set module path as well.

$Result = array();
$Result['content'] =& $tpl->fetch( "design:foo.tpl" );
$Result['path'] = array( array( 'text' => TEXT,
                                          'url' => URL ) );

Note: the module path was set after the tpl was fetched. So in the module template, you actually don't have the access to module path.
6. index.php finally fetch the pagelayout and register $Result variable as $module_result in pagelayout.

However, I guess there is a workaround, but I never tried that before.
Maybe you try to include the toppath template in pagelayout but make it invisible and use ajax to copy the 'innerHTML' of the toppath template into other area.

Michael Lee | Managing Director | ZerusTech Ltd | www.zerustech.com

Skype: zerustech