<?php /** * this will format the string as money */ function smarty_modifier_percent($string) { $string = sprintf('<span class="percent"> %.2f%% </span>', ((double)$string)*100); return $string; } ?>