eZ Community » Forums » eZ Publish 5 Platform » include legacy templates
expandshrink

include legacy templates

include legacy templates

Monday 15 April 2013 12:56:05 pm - 6 replies

Hi,

Are we supposed to be able to run legacy fetch from a legacy template included in a twig one ? 

I'm running the master of both stack and I use the following : 

 {% include "design:parts/website_toolbar.tpl" with {"current_node_id": location.contentInfo.id} %}

All the fetch function doesn't work and I get to following in the legacy logs : 

eZModuleFunctionInfo::loadDefinition:Missing function definition file for module: content
eZFunctionHandler::execute:Cannot execute function 'node' in module 'content', no valid data

Any clue ? Maybe we can't execute fetch ? 

Thanks ! 

Modified on Monday 15 April 2013 12:57:20 pm by Matthieu Sévère

Monday 15 April 2013 1:49:42 pm

I have made some more debug on this and I think I found the issue. 

The method loadDefinition() in lib/ezutils/classes/ezmodulefunctioninfo.php call : file_exists( $path . '/' . $this->ModuleName . '/function_definition.php' ); it is always false because we are in the web directory and the file is located at "../ezpublish_legacy" . $path . '/' . $this->ModuleName . '/function_definition.php'

I have symlinked the kernel in the web directory and now all the fetches are working. 

 

Maybe the script ezpublish:legacy:assets_install should add this symlink to the kernel ? 

Monday 15 April 2013 1:52:47 pm

Hello Matthieu.

I was trying to do the same thing yesterday and I found that the template fetch functuons don't work in a legacy template.

But I found this: https://confluence.ez.no/display/EZP/Legacy+code+and+features (section 'Template parameters').

If you pass to a legacy template the 'location' parameter it is automatically converted to a ezcontentobjecttreenode object.

And if you pass the 'content' parameter it is automatically converted to a ezcontentobject object.

So you can use it directly in the legacy template:

 {% include "design:parts/website_toolbar.tpl" with {"node": location} %}

Modified on Monday 15 April 2013 1:55:12 pm by Kiko Magán

Monday 15 April 2013 1:55:08 pm

Indeed I use this too but I don't want to rewrite all my fetch in eZ 5 ...

And it doesn't need much too work (see my comment above) happy.gif Emoticon 

Monday 15 April 2013 1:57:25 pm

No, this is not normal.

The legacy kernel always do a chdir() to be in the right directory (ezpublish_legacy). Maybe you can open an issue ?

Monday 15 April 2013 2:23:01 pm

I have created the issue EZP-20698.

 

Cheers

Monday 15 April 2013 4:13:28 pm

Thanks for reporting Matthieu !

Pull request for the fix : https://github.com/ezsystems/ezpublish-kernel/pull/297

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from