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

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

Main resources:

Total runtime0.8286 sec
Peak memory usage4,096.0000 KB
Database Queries83

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 587.9141152.6250
Module start 'layout' 0.00710.0033 740.539139.4453
Module start 'content' 0.01030.8171 779.9844670.5547
Module end 'content' 0.82740.0012 1,450.539124.1641
Script end 0.8286  1,474.7031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.4660160.0002
Check MTime0.00140.1646160.0001
Mysql Total
Database connection0.00110.133410.0011
Mysqli_queries0.720886.9870830.0087
Looping result0.00080.1018810.0000
Template Total0.787595.020.3938
Template load0.00210.250820.0010
Template processing0.785494.783820.3927
Template load and register function0.00020.021710.0002
states
state_id_array0.00170.207210.0017
state_identifier_array0.00230.278720.0012
Override
Cache load0.00200.24591120.0000
Sytem overhead
Fetch class attribute can translate value0.00090.103330.0003
Fetch class attribute name0.00210.2526120.0002
XML
Image XML parsing0.00080.096530.0003
class_abstraction
Instantiating content class attribute0.00000.0039150.0000
General
dbfile0.00190.2266160.0001
String conversion0.00000.001340.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
11content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
23content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 52
 Number of unique templates used: 7

Time used to render debug report: 0.0006 secs