Views: how to remove ending zeros from decimal field Suppose, we have a view with a decimal field:



It is output like this:

5 000.000


Is it possible to remove the ending zeros, so it looked like this:

5 000


But if there are meaningful values in the field, it should output all of them. For example:

5.100 -&gt; 5.1
5.010 -&gt; 5.01
5.001 -&gt; 5.001
I created a file /theme/bartik/templates/views-view-field--open-events--page--field-coefficient.tpl.php:

&lt;?php
print (float) $row-&gt;_field_data['id']['entity']-&gt;field_coefficient[LANGUAGE_NONE][0]['value'];


And it worked.