Re: [SMARTY] include template by smarty variable
| From: | messju mohr | Date: | Sun, 06 Apr 2003 08:41:28 +0000 |
| Subject: | Re: [SMARTY] include template by smarty variable | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9141@lists.php.net to get a copy of this message | ||
you use Smarty-2.4.2, right? try 2.5.0-RC2 then you problem will
go away. if you want to stay at 2.4.2 then you have to workaround the problem
with for example:
{include file="modules/"|cat:$module_template|cat:".tpl"} or
{include file="modules/%s.tpl"|sprintf:$module_template}
HTH
messju
On Fri, Apr 04, 2003 at 02:12:45PM +0200, Sascha Willecke wrote:
> I don't understand what you exactly mean! can you explan it please?!
>
> I assign a smarty variable in my php-script name "$module_template". this
> variable contains the name of the template file (for example: index) without
> the fileending (.tpl)! in the {include} funktion I want to load the template
> file given by the php-script!
>
> {include file="modules/$module_template.tpl"} is the same as
> {include file="modules/index.tpl"}
>
> I think it's a probleme with the new smarty version! in my older version I
> never have such problems!
>
>
> "Monte Ohrt" <monte@ispi.net> wrote in message
> news:1049321906.23255.47.camel@lena.ispi.prv...
> > is your variable embedded in quotes named $module_template ?
> >
> >
> > On Thu, 2003-04-03 at 16:02, Sascha Willecke wrote:
> > > Hi,
> > >
> > > i get the folowing error by including an template with an smarty
> variable:
> > >
> > > Warning: Smarty error: unable to read template resource: "modules/i" in
> > > c:\apache\htdocs\includes\Smarty.class.php on line 999
> > >
> > > my source:
> > > file = index.tpl
> > > ...some code...
> > > {if $module_template != ""}
> > > {include file="modules/$module_template.tpl"}
> > > {/if}
> > > ...some code...
> > >
> > > file = index.php
> > > $template->assign("module_template","index_index");
> > >
> > > ...some code...
> > >
> > > $template->display("index.tpl");
> > >
> > > whats wrong?
> > >
> > --
> > Monte Ohrt <monte@ispi.net>
> >
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Fernschach: GUI auf 386/8 MB
nach Frank Klemm