Re: [SMARTY-DEV] How to assign the formatted values ?
| From: | messju mohr | Date: | Tue, 15 Nov 2005 07:15:33 +0000 |
| Subject: | Re: [SMARTY-DEV] How to assign the formatted values ? | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2808@lists.php.net to get a copy of this message | ||
On Mon, Nov 14, 2005 at 08:56:21PM +0100, Arjan Scherpenisse EYEFI wrote:
> Hi,
>
> First of all, you're better off using the regular smarty mailing list
> (smarty-general) for these kind of questions.
>
> I'm not sure if you can use modifiers in an assign statement.
you *can* use modifiers in assign statements. and
{assign var="page_load_time" value=1.7123445}
{assign var="page_load_seconds" value=$page_load_time|string_format:"%.4f"}
{$page_load_seconds}
just works for me as expected.
> There is
> another way to retrieve similar results, using a {capture} block:
>
> {capture
> assign="page_load_seconds"}{$page_load_time|string_format:"%.4f"}{/capture}
>
> regards,
> Arjan
>
> James Mao said the following on 14-11-2005 15:47:
>
> >Hi,
> >
> >I have a variable $page_load_time, and with value = 1.7123445
> >and in template i wrote:
> >{assign var="page_load_seconds",
the comma is wrong here. maybe that's the problem.
> >value=$page_load_time|string_format:"%.4f"}
> >
> >but {$page_load_seconds} output nothing, what's wrong here?
> >
> >Anyone can help me ?
> >
> >Thanks,
> >james.