Re: [SMARTY] How to read a DB table from a template.
| From: | John Wards | Date: | Wed, 02 Oct 2002 09:36:07 +0000 |
| Subject: | Re: [SMARTY] How to read a DB table from a template. | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6074@lists.php.net to get a copy of this message | ||
You can have php code within a template
replace your <?php tags with {php} and ?> with {/php}
On Wednesday 02 Oct 2002 10:21 am, Simone wrote:
> I know ... but the problems wan't read the language to display ... but read
> from the DB the voices list for that language ... I couldn't have a DB
> connection from a tpl file !
>
> Now I have discovered that there is a include_php functin in Smarty ... if
> I include a php file instead of a tpl file I can have a DB connection from
> there ... but the problem now is the opposite ...
>
> "How to pass a parameteres when I use a include_php statement ?"
>
> Simone
>
> On Wednesday 02 October 2002 11:11, you wrote:
> > On Wednesday 02 Oct 2002 9:36 am, Simone wrote:
> > > 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
> >
> > Yes you can
> >
> > {if $lang =='IT}
> >
> > {/if}
> >
> > where lang is a smarty var
> >
> >
> > JOhn