Re: Cache names not persist to current directory change
messju mohr <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 02, 2004 at 04:47:24PM +0400, Dmitry Koteroff wrote:
> >>> If I have 2 templates with name a.tpl (/some/dir/a.tpl and
> >>> /other/dir/a.tpl) and use code something like this:
> >>>
> >>> chdir("/some/dir");
> >>> $output = $smarty->fetch("a.tpl");
> >>> chdir("/other/dir");
> >>> $output = $smarty->fetch("a.tpl");
> >>>
> >>> compiled caches for these tempates are in conflict.
> MM>> yes. if you didn't configure template_dir with an absolute path you
> MM>> are effectively using two different template_dirs when changing the
> MM>> pwd. you need a distinct compile_dir for each template_dir you use.
> DK> Great.
> Maybe add something like $smarty->temp_prefix which will be added
> to each compiled filename (and caches) to make them unique? I
> have a lot of directories with templates, and I have to set own
> cache directory for each of them - thousands of subdirectories!
you can:
- use absolute paths with display() if you prepend "file:" as resource-name
(this is of course suboptimal for {include} where you would have to
put the full path in the file-attribute too)
- pass a compile_id (unique for each template-dir) to display()
- setup your template-dirs as subdirectories below one template_dir. use
"subdir1/index.tpl", "subdir2/index.tpl" as paths to display and
keep $smarty->template_dir constant
and there may be other ways, of course.
greetings
messju
> --
> Best regards,
> Dmitry Koteroff.
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php