How to convert the type 'string' or 'integer' in an array ?

Author Message

Anthony M.

Tuesday 12 December 2006 12:24:24 am

Hello,

I have 2 arrays like this :

tab1 :

Attribute Type Value
id_objet_film integer 126
annee string 2006
mois string 'Décembre'
date_reference string 'val'

tab2 :

Attribute Type Value
id_objet_film object[ezcontentobjectattribute] Object
annee object[ezcontentobjectattribute] Object
mois object[ezcontentobjectattribute] Object
date_reference object[ezcontentobjectattribute] Object

my problem is that i want to have the same structure for these arrays (like the tab2), but i don't know how to convert a string or integer (from the tab1) into object[ezcontentobjectattribute] (like the tab2), with the template language !!!
Can you help me ?
Thanks
Anthony

Anthony

Xavier Dutoit

Tuesday 12 December 2006 10:31:08 am

Hi,

Not sure I got your need. What's the meaning of casting a string (or int) to an object ?

How would your cast "toto" to an object, with a class, a list of data_map and all that jazz ?

X+

http://www.sydesy.com

kracker (the)

Tuesday 12 December 2006 11:06:45 am

I think I hear a familiar if not all too common case when a user is looking to understand quickly how to work within eZ publish.

<b>Stage #1 - Understanding eZ publish template language</b>

To understand that while eZ publish is very flexible, you often must learn how to work within the provided constructs in eZ publish.

It would seem you are learning to use the 'attribute()' operator to display the current node/content object's attributes.

You can 'select' a content object's information. To my knowledge there is not a way to alter the content object's information using template language directly, this is a task best left to php.

Strings can be turned into Arrays in template language in the following way.

{def $folder_id=array(1,2,3,4,5)}

//kracker

<b>References</b>
<i>
http://ez.no/doc/ez_publish/technical_manual/3_8/templates/information_extraction/outputting_node_and_object_data
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/objects/ezcontentobject
http://ez.no/doc/ez_publish/technical_manual/3_8/templates/the_template_language/variable_types
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/arrays/array
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/arrays
</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

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 18 2025 21:14:14
Script start
Timing: Jan 18 2025 21:14:14
Module start 'layout'
Timing: Jan 18 2025 21:14:14
Module start 'content'
Timing: Jan 18 2025 21:14:16
Module end 'content'
Timing: Jan 18 2025 21:14:16
Script end

Main resources:

Total runtime1.6378 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.1406152.6406
Module start 'layout' 0.00510.0027 740.781339.4766
Module start 'content' 0.00791.6284 780.2578588.8047
Module end 'content' 1.63630.0015 1,369.062512.1094
Script end 1.6378  1,381.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.1993160.0002
Check MTime0.00130.0822160.0001
Mysql Total
Database connection0.00080.049210.0008
Mysqli_queries1.579796.4524590.0268
Looping result0.00090.0522570.0000
Template Total1.604798.020.8024
Template load0.00220.134020.0011
Template processing1.602597.842820.8013
Template load and register function0.00020.011210.0002
states
state_id_array0.00120.074410.0012
state_identifier_array0.00170.102320.0008
Override
Cache load0.00190.1144450.0000
Sytem overhead
Fetch class attribute can translate value0.00100.061030.0003
Fetch class attribute name0.00100.061950.0002
XML
Image XML parsing0.00130.077630.0004
class_abstraction
Instantiating content class attribute0.00000.000650.0000
General
dbfile0.00090.0565240.0000
String conversion0.00000.000540.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/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.0001 secs