I guess one solution might be to modify the eZ template 'include' function so that it can be passed template code as a string instead of having to point to a template file.
What URI schemas does 'include' support. I guess if it support HTTP you could pass it the template code this way - instead of from the file-system.
Solution supplied by eZ systems [thanks Kristion] for eZ publish version 3.6.4. It can be added as a 'template operator' extension [good luck working out how to do that ;-]:
/*
* WARNING:
* - This function works directly towards the template system,
* and might not be compatible with new versions of eZ publish.
* - The evaluated code will run in interpreted mode which can behave
(sligtly)
* different from compiled code, and is slower.
* - By using fetches and templatecode in content object attributes you can
* make a system which is very hard to maintain!
*
* This code should ONLY be used by professionals who understands what they
are doing
*/
function ezeval( $templateText )
{
include_once( 'kernel/common/template.php' );
include_once( 'lib/eztemplate/classes/eztemplate.php' );
$tpl =& templateInit();
$root = array( EZ_TEMPLATE_NODE_ROOT, false );
$resourceData = array( 'resource' => 'design', 'template-filename' =>
'eval_code' );
$rootNamespace = '';
$output = '';
$tpl->parse( $templateText, $root, $rootNamespace, $resourceData );
$tpl->process( $root, $output, '', '' );
return $output;
}
You must be logged in to post messages in this topic!