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

eZ debug

Timing: Jan 19 2025 00:20:52
Script start
Timing: Jan 19 2025 00:20:52
Module start 'content'
Timing: Jan 19 2025 00:20:53
Module end 'content'
Timing: Jan 19 2025 00:20:53
Script end

Main resources:

Total runtime0.8490 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 587.7266180.8359
Module start 'content' 0.00640.7107 768.5625537.8359
Module end 'content' 0.71710.1318 1,306.3984332.7500
Script end 0.8489  1,639.1484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4753210.0002
Check MTime0.00150.1722210.0001
Mysql Total
Database connection0.00060.074610.0006
Mysqli_queries0.774091.16541940.0040
Looping result0.00190.22401920.0000
Template Total0.812195.720.4061
Template load0.00200.235820.0010
Template processing0.810195.418920.4051
Template load and register function0.00030.035810.0003
states
state_id_array0.00220.260310.0022
state_identifier_array0.00140.161220.0007
Override
Cache load0.00170.1969210.0001
Sytem overhead
Fetch class attribute can translate value0.00120.145030.0004
Fetch class attribute name0.00120.142940.0003
XML
Image XML parsing0.00100.117930.0003
class_abstraction
Instantiating content class attribute0.00000.001340.0000
General
dbfile0.00520.6079270.0002
String conversion0.00000.000830.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/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: 13
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs