Home > Archive > PHP Programming > June 2004 > Smarty problems
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| Hello all,
I'm having a little problem with Smarty. Getting it to work in a simple
case went fine, but now I have the following situation:
/
/smarty
/templates
template.tpl
/templates_c
/configs
/lezingen/
lezingen_beh.php
agenda_beh.php
/index.php
With files such as index.php, I can just access smarty by including
"smarty/Smarty.class.php" and displaying it with
$smarty->assign("template.tpl").
However, in the directory "lezingen" (which is protected using a
..htaccess file, but I doubt if that is of any relevance here) I am
unable to get smarty to work. I have tried adding the following code to
lezingen_beh.php and agenda_beh.php:
set_include_path(get_include_path() . ":../smarty");
This seems to solve *part* of the problem, but it still gives the
following error:
Warning: Smarty error: unable to read template resource: "template.tpl"
in /very_long_path/nieuw/smarty/Smarty.class.php on line 1042
Can anyone point out what the problem is and also how to fix it? I
couldn't figure it out using the smarty or php documentation...
Thanks in advance for any help,
--
Daan
| |
|
|
"Daan" <d_stolp@NoSpamHotmail.com> wrote in message
news:cbp845$lek$1@netlx020.civ.utwente.nl...
> Hello all,
>
> I'm having a little problem with Smarty. Getting it to work in a simple
> case went fine, but now I have the following situation:
>
> /
> /smarty
> /templates
> template.tpl
> /templates_c
> /configs
> /lezingen/
> lezingen_beh.php
> agenda_beh.php
> /index.php
>
> With files such as index.php, I can just access smarty by including
> "smarty/Smarty.class.php" and displaying it with
> $smarty->assign("template.tpl").
>
> However, in the directory "lezingen" (which is protected using a
> .htaccess file, but I doubt if that is of any relevance here) I am
> unable to get smarty to work. I have tried adding the following code to
> lezingen_beh.php and agenda_beh.php:
>
> set_include_path(get_include_path() . ":../smarty");
>
> This seems to solve *part* of the problem, but it still gives the
> following error:
>
> Warning: Smarty error: unable to read template resource: "template.tpl"
> in /very_long_path/nieuw/smarty/Smarty.class.php on line 1042
>
> Can anyone point out what the problem is and also how to fix it? I
> couldn't figure it out using the smarty or php documentation...
>
> Thanks in advance for any help,
>
> --
> Daan
What's your $template_dir set to?
http://smarty.php.net/manual/en/api...le.template.dir
Quote:
$template_dir
This is the name of the default template directory. If you do not supply a
resource type when including files, they will be found here. By default this
is "./templates", meaning that it will look for the templates directory in
the same directory as the executing php script.
Technical Note: It is not recommended to put this directory under the web
server document root.
Garp
| |
|
| Garp wrote:
> "Daan" <d_stolp@NoSpamHotmail.com> wrote in message
> news:cbp845$lek$1@netlx020.civ.utwente.nl...
>
> What's your $template_dir set to?
>
> http://smarty.php.net/manual/en/api...le.template.dir
>
> Quote:
> $template_dir
> This is the name of the default template directory. If you do not supply a
> resource type when including files, they will be found here. By default this
> is "./templates", meaning that it will look for the templates directory in
> the same directory as the executing php script.
Ah, thanks! Setting template dir to "../templates" did the trick!
$smarty->template_dir = "../templates";
--
Daan
|
|
|
|
|