How to read a DB table from a template.
| From: | Simone | Date: | Wed, 02 Oct 2002 08:36:50 +0000 |
| Subject: | How to read a DB table from a template. | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6071@lists.php.net to get a copy of this message | ||
Situation
I have a template file that dispay the menu of my website.
I call my template (Smarty) like this (from a .tpl file)
{include file=menu.tpl Selected=1}
Where
- menu.tpl is the name of my template file with the code for the menu
displaying
- Selected is the number of the selected voice of the menu.
Now the question :
The voices of the menu has to change in order of the language selected by the
user (it is a session variable). For example if the user is Italian has to
appear a menu wrote in Italian and so on.
I thought I can do a call like
{include file=menu.tpl Selected=1 Lang=IT}
and once inside at menu.tpl write the right menu voices.
The point is that I can't access a database with all the translation from the
file menu.tpl and
So i can't write
If ($Lang = 'IT') then
read all the italian voices from the DB
If ($Lang = 'EN') then
read all the English voices from the DB
I can't do it eather from the file from where I call menu.tpl because is a
template too !!!
So what can I do ?
Tanks Simone