Re: [SMARTY] Same template filename in multiple directories in path
| From: | Owen Cole | Date: | Fri, 22 Sep 2006 14:03:13 +0000 |
| Subject: | Re: [SMARTY] Same template filename in multiple directories in path | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-13485@lists.php.net to get a copy of this message | ||
If you are not using caching you simply need to set a $compile_id that is based upon the current template directory that you are using.
http://smarty.php.net/manual/en/variable.compile.id.php
If you are using caching and could possibly have multiple sets of data displayed from the same template (under the same $compile_id), then you would add in a custom $cache_id.
This will allow for multiple caches of the same template, but with different versions.
http://smarty.php.net/manual/en/caching.multiple.caches.php
Good luck!
Owen
Saliga Gábor wrote:
| -----Original Message----- | From: Mark Rogers [mailto:mark@quarella.co.uk] | Sent: Friday, September 22, 2006 11:33 AM | To: smarty-general@lists.php.net | Subject: [SMARTY] Same template filename in multiple | directories in path | | | I'm sure I should know the answer to this, but I can't find it: | | I have multiple directories in my template path, which will | vary on multiple calls to my script, but there's always a | default template directory. All of them contain a file | "index.tpl", so depending on the template path for any given | call to my script I will be targetting a different index.tpl. | | It seems [*] that they all compile to the same file in | templates_c, so I generally get the last compiled version of | the wrong template. | | How do I fix this? | | [*] I'm debugging this remotely and that's the conclusion | I've reached; the site is currently using v2.6.3. If an | upgrade will fix it or this just shouldn't be happening | anyway I'll look for other problems in my code. | | -- | Mark Rogers | More Solutions Ltd Hello, It think you should set a different templates_c directory for each template directory. I mean: $smarty->compile_dir = 'different in every case'; Regards, Gábor Saliga