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.

eZ debug

Timing: Jan 31 2025 00:26:05
Script start
Timing: Jan 31 2025 00:26:05
Module start 'layout'
Timing: Jan 31 2025 00:26:05
Module start 'content'
Timing: Jan 31 2025 00:26:06
Module end 'content'
Timing: Jan 31 2025 00:26:06
Script end

Main resources:

Total runtime0.8817 sec
Peak memory usage8,192.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0067 588.1484151.2109
Module start 'layout' 0.00680.0044 739.3594220.6875
Module start 'content' 0.01120.8694 960.04694,494.6328
Module end 'content' 0.88060.0010 5,454.679711.8438
Script end 0.8816  5,466.5234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.4448160.0002
Check MTime0.00160.1810160.0001
Mysql Total
Database connection0.00150.167510.0015
Mysqli_queries0.778388.2689620.0126
Looping result0.00080.0935600.0000
Template Total0.825593.620.4127
Template load0.00240.268020.0012
Template processing0.823193.352320.4115
Template load and register function0.00160.177410.0016
states
state_id_array0.00150.169710.0015
state_identifier_array0.00110.130220.0006
Override
Cache load0.00180.2093240.0001
Sytem overhead
Fetch class attribute can translate value0.00230.255430.0008
Fetch class attribute name0.00250.287050.0005
XML
Image XML parsing0.00270.303530.0009
class_abstraction
Instantiating content class attribute0.00000.001550.0000
General
dbfile0.00360.4103180.0002
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs