Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

comment arrondir un nombre réel dans smarty ?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French
View previous topic :: View next topic  
Author Message
sadweb
Smarty n00b


Joined: 12 Aug 2008
Posts: 1

PostPosted: Tue Aug 12, 2008 4:37 am    Post subject: comment arrondir un nombre réel dans smarty ? Reply with quote

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
View user's profile Send private message
mumuri
Smarty Rookie


Joined: 06 Apr 2008
Posts: 27

PostPosted: Sun Sep 07, 2008 1:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP