Re: [SMARTY] Smarty unable to read template resource?
| From: | Monte Ohrt | Date: | Mon, 13 Jan 2003 21:39:14 +0000 |
| Subject: | Re: [SMARTY] Smarty unable to read template resource? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7153@lists.php.net to get a copy of this message | ||
On Mon, 2003-01-13 at 15:30, Brian Fidler wrote:
> I tried by adding the following (though with the appropriate hard coded
> path) to my script but it still wouldn't work...
>
> $smarty->template_dir =
> '/web/www.mydomain.com/smarty/guestbook/templates/';
> $smarty->compile_dir =
> '/web/www.mydomain.com/smarty/guestbook/templates_c/';
> $smarty->config_dir = '/web/www.mydomain.com/smarty/guestbook/configs/';
> $smarty->cache_dir = '/web/www.mydomain.com/smarty/guestbook/cache/';
>
> Any reason for this?
Yes, Smarty needs to know where to look for templates, configs, etc.
>
> ...and for the record I do have Smarty working, I just can't use it in
> any php scripts that are not on the same directory level with my
> templates and templates_c directories.
This leads me to believe that the directory settings are not taking
affect. Try setting up a new application from scratch following the
installation instructions, see if that at least works. If it does, then
decipher what the difference is with your setup.
You should be able to do this:
$smarty = new Smarty;
$smarty->template_dir = '/absolute/path/to/template_dir/';
$smarty->display('admin/index.tpl');
and find the template you're after (admin is a subdir of your
template_dir)
>
> Brian
>
>
>
> On Monday, January 13, 2003, at 01:58 PM, Monte Ohrt wrote:
>
> >
> > Smarty will not look for the templates and templates_c directories in
> > the same directory as your Smarty library files. By default it will
> > look
> > in the CWD, the same directory as the executing script. If they are
> > somewhere else, you will need to change $template_dir and $compile_dir
> > settings. See the Smarty installation docs for examples of good methods
> > to set things up.
> >
--
Monte Ohrt <monte@ispi.net>