Re: [SMARTY-DEV] Template path including '.'?
| From: | messju mohr | Date: | Tue, 23 Dec 2003 13:20:00 +0000 |
| Subject: | Re: [SMARTY-DEV] Template path including '.'? | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2011@lists.php.net to get a copy of this message | ||
On Tue, Dec 23, 2003 at 01:06:50PM -0000, Mark Rogers wrote:
> I'm having some strange problems which seem to be template path related, but
> I'm not sure if it's me or Smarty. Consider the following (/www/htdocs is
> the server's DocumentRoot):
> /www/htdocs/contact.htm
> ..
> $smarty->assign('body', 'contact.htm');
> $smarty->display('default.tpl');
>
> /www/templates/default.tpl
> ..
> {include file=$body}
>
> /www/templates/contact.htm
> Hello World!
>
> This work's fine; the PHP code in the first contact.htm causes Smarty to
> display my template default.tpl, which in turn includes the contact.htm in
> my templates directory. (Obviously, /www/templates is in my Smarty
> $template_dir path setting.)
>
> However, if I delete the contact.htm from /www/templates, instead of
> complaining Smarty uses contact.htm from /www/htdocs, ie the PHP source
> code.
>
> It looks as though Smarty is looking in the "current" (ie script) directory
> for templates, but I can't see where in the code this is happening.
> (/www/htdocs is not in Smarty's template path.)
>
> Is this a bug, or is it me making an idiot of myself?
smarty uses php's include_path to look for templates if it cannot find
the template in $smarty->template_dir . it's more an undocumented
feature than a bug, IMHO
> This is with 2.6.0-RC2.
consider upgrading to 2.6.0 . some bugs are fixed in there.
greetings
messju
> --
> Mark Rogers,
> More Solutions Ltd