By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,724 Members | 1,868 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,724 IT Pros & Developers. It's quick & easy.

Smarty problems

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a

"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

P: n/a
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.