Forums / General / Changing the value of one attribute

Changing the value of one attribute

Author Message

Hugo Siles

Thursday 08 April 2004 2:01:04 pm

Hi, i want to know if it's posible to change the value of one object in one node. For example, I have extended the article class, now it has a new intenger attribute, what I want is that this attribute get incremented every time the node it's viewed.

In the template for viewing this article I put something like this

{set $node.data_map.volumen.data_int = inc($node.data_map.volumen.data_int) }

where volume is the integer attribute that I want to increment.. I'd apreciate any idea

thanks

Hugo

Marco Zinn

Thursday 15 April 2004 2:14:13 pm

Hi,
as i understand it, templates are just "viewing" the content of the objects (attributes), but the cannot modify it. So, your attempt will not work.
I guess, that you need an "operator", which might give you access to writing an attribute to the database.
What do you want to do? If you want a view-counter, i suggest, that you analyze the webserver log.
If you really need/want the data in the db, read about "workflows". There is a trigger called "after_read" or so, that might help you.

Marco
http://www.hyperroad-design.com

Hugo Siles

Friday 16 April 2004 5:50:13 am

Hi Marco,
thanks for your reply, I really apreciate it, but could you tell more about this workflow where I can find some documentation about this topic, or could you tell me what should I have to do.... thanks..

Cheers

Hugo