Re: [SMARTY] modifiers functions
| From: | Matt Warden | Date: | Sun, 13 Mar 2005 02:41:04 +0000 |
| Subject: | Re: [SMARTY] modifiers functions | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12325@lists.php.net to get a copy of this message | ||
Werner,
On Sun, 13 Mar 2005 04:31:16 +0200, Werner <nospam@ubertech.co.za> wrote:
> Now *that's* interesting! Thanks for pointing it out, it will make my
> life a bit easier from now on. I suppose I should have read the manual
> more thoroughly :-)
Yeah, one of the nicest things about smarty is that they set it up so
you have access to all the php functions directly (I mean, Smarty is
php, so why not?).
> BTW: Try calling @str_pad as a variable modifier, and try to specify
> " " as the pad string. Also try to specify one of the pad_type
> options. Do you also get weird output? (I'm using version 2.6.6).
Are you calling it on an array? The @ means "apply this to an array as
a whole, not each element of the array". I don't think this is what
you want. Try it without the @.
However, you cannot use str_pad directly like you want, I don't think.
THis is because your pad string is > 1 character, but you want it to
be treated like a single character. Try padding with an actual space
(this is the default) then then use str_replace to change spaces to
The way you have it now, I think you will end up with something like:
short string &n
which is not what you want.
--
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com
This email proudly and graciously contributes to entropy.