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

eZ debug

Timing: Jan 19 2025 09:11:08
Script start
Timing: Jan 19 2025 09:11:08
Module start 'content'
Timing: Jan 19 2025 09:11:09
Module end 'content'
Timing: Jan 19 2025 09:11:09
Script end

Main resources:

Total runtime1.4518 sec
Peak memory usage4,096.0000 KB
Database Queries220

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 592.5703180.8359
Module start 'content' 0.00731.3042 773.4063675.6328
Module end 'content' 1.31150.1402 1,449.0391344.4375
Script end 1.4517  1,793.4766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.2832210.0002
Check MTime0.00150.1024210.0001
Mysql Total
Database connection0.00110.073910.0011
Mysqli_queries1.342792.48602200.0061
Looping result0.00240.16832180.0000
Template Total1.421797.920.7108
Template load0.00250.169320.0012
Template processing1.419297.756320.7096
Template load and register function0.00010.008310.0001
states
state_id_array0.00120.084710.0012
state_identifier_array0.00090.060020.0004
Override
Cache load0.00240.16401120.0000
Sytem overhead
Fetch class attribute can translate value0.00180.126640.0005
Fetch class attribute name0.00110.0746120.0001
XML
Image XML parsing0.00100.068740.0002
class_abstraction
Instantiating content class attribute0.00000.0024150.0000
General
dbfile0.00400.2724270.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 52
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs