Re: [SMARTY] date formatting
[email protected] (Peggy Schatz) Fri, 05 Oct 2007 09:57:11 +0200
| Newsgroups | php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
Yes, I used a simple plugin of my own:
function smarty_modifier_mydate_format($date_in,$lang)
{
if($date_in != "") {
$temp = explode("-",$date_in);
if($lang == "german") {
$date_out = $temp[2]. "." . $temp[1] . "." .$temp[0];
}
else {
$date_out = $temp[1]. "/" . $temp[2] . "/" .$temp[0];
}
return $date_out;
}
}
I'll take a look at PEAR::Date too, since PEAR is implemented anyway.
Thanks!
Ciao,
Peggy
> Another option is to override the built-in date_format function with
> your own plugin that has more robust date handling such as PEAR::Date.
> To override built-in plugins, you can add an entry to the beginning of
> the plugins_dir array:
>
> $tpl = new Smarty();
> array_unshift($tpl->plugins_dir, '/my/plugins/dir/');
>
> - Ken Snyder