Attribute_view_gui in a php file

Author Message

Jacques Feix

Monday 29 October 2007 2:54:49 am

Hi everybody,
I would like to execute a 'Attribute_view_gui' in a php file, not in a tpl file but I can't find how to do it

Where are the definition/code for this type of operator ?

Thx

Ɓukasz Serwatka

Monday 29 October 2007 6:06:43 am

Hi Jacques,

This is not possible directly. Take a look on example here:
http://serwatka.net/en/blog/ez_publish_content_object_attributes_output_rendering

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Jacques Feix

Monday 29 October 2007 6:29:45 am

Thank you for your anwser :)

here is your code

<?php
 
include_once( 'lib/ezutils/classes/ezcli.php' );
include_once( 'kernel/classes/ezscript.php' );
 
$cli =& eZCLI::instance();
$script =& eZScript::instance( array( 'use-modules' => true ) );
 
$script->startup();
 
$options = $script->getOptions();
 
$script->initialize();
 
include_once ('lib/ezutils/classes/ezfunctionhandler.php');
include_once( 'kernel/common/template.php' );
$tpl = templateInit();
 
$node = eZFunctionHandler::execute( 'content','node', array( 'node_id' => 2) );
$object =& $node->object();
 
foreach( $object->contentObjectAttributes() as $contentObjectAttribute )
{
 $datatypeString = $contentObjectAttribute->attribute( 'data_type_string' );
 $tpl->setVariable( 'attribute', $contentObjectAttribute );
 $cli->output( $tpl->fetch( 'design:content/datatype/view/' . $datatypeString . '.tpl') );
}
 
$script->shutdown();
 
?>

I am not sure that in my case it will work perfectly.
Actually I have a "view" parameter

{node_view_gui content_node=$my_node view=link}

Michael Maclean

Friday 02 November 2007 3:09:15 am

You should then just be able to add another parameter to the template engine:

$tpl->setVariable( 'attribute', $contentObjectAttribute );
$tpl->setVariable( 'view', 'link' );

Just before the call to $tpl->fetch();.

eZpedia community documentation project | http://ezpedia.org

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