Display an attribute of a data type

Author Message

Albe Terra

Tuesday 20 May 2008 2:46:22 am

Hi!
How can I display an attribute of a data type?
For example, I want to display the "alternative text" of an image as a caption. This is the code:

 

     {attribute_view_gui attribute=$node.data_map.image.content.alternative_text|wash(xhtml)}
 

Where's the error? Thanks, Albe

Maxime Thomas

Wednesday 21 May 2008 11:41:16 pm

Hi Albe,

A small explanation : the attribute_view_gui is a template function which allows you to automatically load a generic template for this attribute. It takes in argument the object attribute. Each nodes have a data_map array which is containing the attributes object which compose it.
So, to correct your code :

{$node.data_map.image.content.alternative_text|wash(xhtml)}

If you want to see what is inside an array or an object you can use :

{$node|attribute(show,1)}

Hope it helps.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

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 19 2025 07:05:20
Script start
Timing: Jan 19 2025 07:05:20
Module start 'layout'
Timing: Jan 19 2025 07:05:20
Module start 'content'
Timing: Jan 19 2025 07:05:20
Module end 'content'
Timing: Jan 19 2025 07:05:20
Script end

Main resources:

Total runtime0.0180 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 590.3125152.6250
Module start 'layout' 0.00700.0031 742.937539.4453
Module start 'content' 0.01020.0059 782.382889.4609
Module end 'content' 0.01600.0020 871.843830.3047
Script end 0.0180  902.1484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002413.2648140.0002
Check MTime0.00116.1067140.0001
Mysql Total
Database connection0.001910.418510.0019
Mysqli_queries0.003418.673130.0011
Looping result0.00000.088610.0000
Template Total0.00168.810.0016
Template load0.00084.526110.0008
Template processing0.00084.298610.0008
Override
Cache load0.00063.118810.0006
General
dbfile0.00179.167380.0002
String conversion0.00000.050340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs