Re: [SMARTY] Padding Strings

From: Date: Sat, 13 Mar 2004 10:00:46 +0000
Subject: Re: [SMARTY] Padding Strings
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11114@lists.php.net to get a copy of this message
Sorry, I didn't explain it well enough, because I don't know what the string will be as it comes from a db, so it could be: ---ab--- I basically want to pad a string left and right, but dynamically, ie the same as: <?php $input = "Alien"; echo str_pad($input, 10, "_", STR_PAD_BOTH); // produces "__Alien___" ?> Jake On 13/3/04 9:37, "David Förster" <david@dfoerster.de> wrote: >> What is the easiest way to pad a string in smarty? > > Just embed the smarty-var in the string: > --{$myVar}-- > > works also in loops ;) > > - david

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