In last tutorial have explained how to fetch eZ publish content objects with PHP. In this post I will show how to access eZ publish content objects attributes of all available datatypes. For testing PHP code we will re-use the same CLI script. This example you can re-use in your custom modules, cron jobs scripts, etc.
Thank you to Kristian Hole for his initial idea.
Here is edited and enhanced working code for rendering content objects attributes output:
#!/usr/bin/env php <?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(); ?>
The presented example uses the standard datatype templates only. It will not take into consideration override-rules you have in your override.ini(.append.php). In the case that you have such rules, you need to load the correct templates yourself.
No trackbacks.
eZ publish is a open source enterprise content management system and development framework with functionality for web publishing, intranets, e-commerce and more.


As Microsoft Silverlight technology is becoming increasingly popular, it will be supported in the upcoming eZ Publish 4.1 release. Sites using the Website Interface and eZ Flow will include a Silverlight class and the corresponding view templates. Simply upload .xap files (compressed Silverlight package) as attributes in Silverlight objects; when such an object is viewed by a site visitor, your Silverlight media is loaded in the web browser (provided that the visitor has the Silverlight browser plugin installed). This is similar to how eZ Publish already supports .swf files via the Flash class. More information will be available as the next eZ Publish release date approaches.
eZ Publish developer day in Warsaw, Poland - 15th April 2008I happy to announce first eZ Publish developer day that will be held in Warsaw in Poland on 15th of April 2008. First time eZ goes to Poland ;) eZ Publish developer day is community-driven event and open for all attendees. Agenda will be settled at the event by the attendees. Some discussions will be in English.
Roadmap for eZ Publish 4.1 and 4.5A roadmap for the next eZ Publish releases is now available. eZ Publish 4.1, the next major release, will include the new Online Editor, as was previously mentioned in Community Newsletter #1/2008. The new Online Editor will have various enhancements regarding usability and the user interface, and will support Internet Explorer 7 for Windows Vista. eZ Publish 4.1 is expected to be released in the first quarter of 2008.