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.