|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
sadweb Smarty n00b
Joined: 12 Aug 2008 Posts: 1
|
Posted: Tue Aug 12, 2008 4:37 am Post subject: comment arrondir un nombre réel dans smarty ? |
|
|
bonjour;
J' ai un tableau de valeur réel ( résultat reçu après appel soap)
je veut formater et arrondir les valeurs au moment de l'affichage.
J'ai essayer d'appliquer la fonction $result = array_map('round',$tab);
function arrondir($x){
if ( is_float($x) ) {
return round($x);
} else {
return $x;
}
}
mais ca mache pas sachant que le tableau retourné est multidimensionnel.
Est ce qu'il y a un modificateur ou fonction smarty pour formater ce type d'affichage ?
Merci |
|
Back to top |
|
mumuri Smarty Rookie
Joined: 06 Apr 2008 Posts: 27
|
Posted: Sun Sep 07, 2008 1:52 pm Post subject: |
|
|
si ton tableau est bidimensionel, tu dois pouvoir faire 2 foreach imbriqués, mettre le tout dans un modifier
et l'appeler comme çà dans ton template
{$tab|roundTab} ou roundTab serait le nom de ton modifier |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|