467,104 Members | 1,024 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,104 developers. It's quick & easy.

Smarty problems

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
Jul 17 '05 #1
  • viewed: 2616
Share:
2 Replies

"Daan" <d_*****@NoSpamHotmail.com> wrote in message
news:cb**********@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....e.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
Jul 17 '05 #2
Garp wrote:
"Daan" <d_*****@NoSpamHotmail.com> wrote in message
news:cb**********@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...

What's your $template_dir set to?

http://smarty.php.net/manual/en/api....e.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
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Richard | last post: by
reply views Thread by Matt | last post: by
reply views Thread by syam | last post: by
reply views Thread by grezlik | last post: by
9 posts views Thread by adamjblakey | last post: by
1 post views Thread by Brennan Mann | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.