Forums / Developer / Put attribute into variable

Put attribute into variable

Author Message

Enk bila

Monday 21 June 2004 6:14:24 am

hi,

How can I put the attribut's value into a variable (in template):

When I used : {attribute_result_gui attribute=$node.object.data_map.formulaire}

The result is the correct value. But now I need test/use this value in my template :

is it this syntax correct?

{let test = {attribute_view_gui attribute=$node.object.data_map.formulaire}

???

Eirik Alfstad Johansen

Monday 21 June 2004 6:31:42 am

Hi Enk,

Use this:

{let test=$node.object.data_map.formulaire}

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Enk bila

Monday 21 June 2004 7:18:41 am

when I used :

{let test=$node.object.data_map.formulaire}

{$test}

The result is :

Object(ezcontentobjectattribute)

??? do you have a solution ???

Eirik Alfstad Johansen

Monday 21 June 2004 7:26:02 am

Hi Enk,

You can do

{let test=$node.object.data_map.formulaire|attribute(show)}

... to view the contents of the object.

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Enk bila

Monday 21 June 2004 7:49:26 am

Thanks but now I've too many informations :

Attribute Type Value
id string 1257
contentobject_id string 108
version string 8
language_code string 'eng-GB'
contentclassattribute_id string 287
attribute_original_id string 0
sort_key_int string 0
sort_key_string string ''
data_type_string string 'ezenum'
data_text string ''
data_int string 0
data_float string 0
contentclass_attribute object[ezcontentclassattribute] Object
>id string 287
>name string 'Formulaire à appliquer'
>version string 0
>contentclass_id string 16
>identifier string 'formulaire'
>placement string 14
>is_searchable string 1
>is_required string 0
>can_translate string 1
>is_information_collector string 0
>data_type_string string 'ezenum'

etc...

In fact , I created an attribut (Enum) and with the content of this attribut I try to use a spécifique template ex :

If my attribut content is "XX.tpl" and his name is "formulaire" I would lyke introduce this line in my master template :

{include uri="design:" $formulaire}

If you can help me or if you have e alternative solution -- Many tahnks --

regards

Eirik Alfstad Johansen

Monday 21 June 2004 8:11:42 am

Hi Enk,

Have you tried:

{let test=$node.object.data_map.formulaire.content}

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Enk bila

Monday 21 June 2004 8:16:58 am

The result is : Object(ezenum)

That's crazy No ?

Eirik Alfstad Johansen

Thursday 24 June 2004 1:23:24 am

Hi Enk,

No, that's not crazy, that just means that $node.object.data_map.formulaire.content is an object. To view it's attributes, do

{$node.object.data_map.formulaire.content|attribute(show)}

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Enk bila

Tuesday 29 June 2004 8:26:37 am

Hi,

When I use :

{$node.object.data_map.formulaire.content|attribute(show)}

The result is: "Attribute Type Value"

"formulaire" is an attribute of my class I would like retrieve the content of this atribute in a variable ....

Help please .

What I not anderstand ??

 

steve walker

Monday 06 December 2004 1:35:32 am

Hi there,

Having exactly the same problem as this thread, and it doesnt look like this was concluded.

I have a page where your looking at a product and I want to put the price value into a variable and display it in other places on the page with some mathematical adjustments.

I want to something on the lines of:

{let sprice=$attribute.content.price}
price is {$sprice}
{/let}

I'ved tried loads of different expressions to get 'let sprice=something_here' working but, but cant get the numerical value of the price without currency info to display...

Any ideas on this one?

Thanks, Steve.

http://www.oneworldmarket.co.uk

steve walker

Wednesday 15 December 2004 9:54:08 am

Hi,

Found the answer to this thanks to Paul F. The code:

{let aprice=$node.data_map.price.content.inc_vat_price} 

popped the price into a variable nicely!

Steve.

http://www.oneworldmarket.co.uk