Reducing decimals in poll-results

Author Message

K259

Tuesday 03 January 2006 4:56:52 am

The code in: design/standard/templates/content/datatype/result/count/ezoption.tpl
is displaying:
Answer to the pull: YES:
7 / 77,777777777778%
Answer to the pull: NO:
2 / 22,222222222222%
These numbers represent the $total_count
I want to only get two decimals..how is it possible to achieve this in eZ publish?
I can't fint any operator for this..

{$:item_count} / <i>{div(mul($:item_count,100),$total_count)}%</i>

Kristian Hole

Tuesday 03 January 2006 5:14:43 am

You can use shorten:
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/strings/shorten

example:
{'33.3333333'|shorten(4,'')}

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

K259

Tuesday 03 January 2006 5:57:16 am

Tnx. It works.

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 31 2025 04:34:38
Script start
Timing: Jan 31 2025 04:34:38
Module start 'layout'
Timing: Jan 31 2025 04:34:38
Module start 'content'
Timing: Jan 31 2025 04:34:38
Module end 'content'
Timing: Jan 31 2025 04:34:38
Script end

Main resources:

Total runtime0.0149 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.1406151.2109
Module start 'layout' 0.00510.0023 739.351636.6641
Module start 'content' 0.00730.0059 776.015690.1563
Module end 'content' 0.01320.0016 866.171929.9922
Script end 0.0148  896.1641 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002416.4915140.0002
Check MTime0.00117.1946140.0001
Mysql Total
Database connection0.00096.307110.0009
Mysqli_queries0.002013.151830.0007
Looping result0.00000.080210.0000
Template Total0.00128.110.0012
Template load0.00096.031010.0009
Template processing0.00032.033310.0003
Override
Cache load0.00064.288210.0006
General
dbfile0.001510.396280.0002
String conversion0.00000.054640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs