Forums / Developer / Reducing decimals in poll-results

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.