Thousands separator and nl2br()

From: Date: Sat, 13 Jul 2002 12:08:04 +0000
Subject: Thousands separator and nl2br()
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5277@lists.php.net to get a copy of this message
Hi folks, Bit of a newbie to Smarty (used FastTemplate before...where have I been?!?!? :P), but I hope you can help me out on a couple of easy problems.....as it is the weekend and all that! I pull out results from a db into an assoc array like so ($dba is my db abstraction class, $result = handle from executing the SQL query): ---------------8<------------------------------- while ( $row = $dba->fetch_assoc($result) ) { $output[] = $row; } ---------------8<------------------------------- $output can then be used by {section} in the template to loop through the rows.... (1) Is there a way to format a number e.g. 100000 in the template with a thousands separator so that it appears 100,000? Now I know I can build up the array $output by explicitly specifying the format of each field, but I'm in a lazy mood! ;) (2) Another problem relates to formatting in the template file, where I have a text field with "\n" in it to represent newlines, and again, if I was building $output explicitly I could just use nl2br($var)......is it possible to do this in a template file? Thanks! _________ Simon Lee --- LeapForward --- creative intelligence for the networked economy 167a Clapham High Street, London SW4 7SS t: +44(0)70 9234 1503 f: +44(0)70 9234 1787 e: simon.lee@leapforward.net www.leapforward.net

« previous php.smarty.general (#5277) next »