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

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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

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 Exponential.

<b>Stage #1 - Understanding Exponential template language</b>

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

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/