Re: $smarty
| From: | Andrei Zmievski | Date: | Thu, 28 Feb 2002 14:26:53 +0000 |
| Subject: | Re: $smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2892@lists.php.net to get a copy of this message | ||
On Thu, 28 Feb 2002, Aapo Laakkonen wrote:
> Is this easy to fix in smarty?
>
> {assign var="lang" value=$smarty.request.lang|lower|default:"fi"}
>
> Gives me error:
>
> Warning: Undefined index: lang in XXX on line X.
For one, I would suggest using specific array where you expect 'lang' to
be, that is, $smarty.get, or $smarty.post, etc.
But even then, it's not going to be possible to fix this notice message.
> file: translations.conf
>
> [en]
> hello=Hello
>
> [fi]
> hello=Terve
>
> file: index.php
>
> <?php
> require "Smarty.class.php";
> $smarty = new Smarty;
> $smarty->display("index.tpl");
> ?>
>
> file: index.tpl
>
> {assign var="lang" value=$smarty.request.lang|lower|default:"en"}
> {config_load file="translations.conf" section=$lang}
> {#hello#}
>
> But it doesn't work. Do you have any other opinions on how to do site
> with multiple languages using smarty. I have seen one example with
> Pre-filters, but I did not like it, because those translations were not
> located on centralized place.
That's how we do translations. What didn't work for you?
-Andrei
"You choose to do the bad things in your life;
the good ones come and drag you along with them."
- Michael Marshall Smith