View previous topic :: View next topic |
Author |
Message |
ewebzerg Smarty n00b
Joined: 27 Apr 2003 Posts: 4
|
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Mon Apr 28, 2003 2:43 pm Post subject: |
|
|
I believe it would work because Smarty uses internal cache id's, but I could be wrong. _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
ewebzerg Smarty n00b
Joined: 27 Apr 2003 Posts: 4
|
Posted: Mon Apr 28, 2003 2:49 pm Post subject: |
|
|
AZTEK wrote: | but I could be wrong. |
what's your meaning ?
"/news/templates/index.tpl" and "/member/templates/index.tpl" have the same cache filename: index.tpl.php !!! can they use the same cache directory ?
Last edited by ewebzerg on Wed May 05, 2010 10:49 pm; edited 1 time in total |
|
Back to top |
|
Wom.bat Smarty Pro
Joined: 24 Apr 2003 Posts: 107 Location: Munich, Germany
|
Posted: Mon Apr 28, 2003 3:08 pm Post subject: |
|
|
try $compile_id |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Mon Apr 28, 2003 7:05 pm Post subject: |
|
|
ewebzerg wrote: | what's your meaning ? |
Smarty has internal id's for caching and if it doesnt automaticly you can pass it in the display() method _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Last edited by AZTEK on Mon Apr 28, 2003 7:40 pm; edited 1 time in total |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Apr 28, 2003 7:27 pm Post subject: |
|
|
From the manual (sorry I can't get the online page for you, but I'm being blocked by a an insanely paranoid firewall at this location)
See Chapter 14: Cache Groups
Quote: | Technical Note: The cache grouping does NOT use the path to the template as any part of the cache_id. For example, if you have display('themes/blue/index.tpl'), you cannot clear the cache for everything under the "themes/blue" directory. If you want to do that, you must group them in the cache_id, such as display('themes/blue/index.tpl','themes|blue'); Then you can clear the caches for the blue theme with clear_cache(null,'themes|blue') |
See Also: $use_sub_dirs |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Mon Apr 28, 2003 7:41 pm Post subject: |
|
|
See then I was right... sortof _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Apr 28, 2003 8:50 pm Post subject: |
|
|
To be safe, use a separate templates_c directory for every template_dir. Otherwise, you could use a different compile_id for each template_dir if you're not using it for something else.
Monte |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Apr 28, 2003 8:53 pm Post subject: |
|
|
but the main question was, if the same template-filenames in different directories are okay. this does not affect caching in the first place, it does just affect the compiled templates and how they are stored.
they are stored with the "full"-path relative to the $templates_dir.
that means:
$smarty->display('dir1/foo.tpl'); and then
$smarty->display('dir2/foo.tpl'); is fully okay and will lead to two distinct files below templates_c.
but
$smarty->templates_dir = 'dir1';
$smarty->display('foo.tpl');
and then
$smarty->templates_dir = 'dir2';
$smarty->display('foo.tpl');
is not okay, and will lead to the same file being overwritten in templates_c!!! you'll have to use a distinct $compile_dir for every $templates_dir you use. it's better to use just one $template_dir, then you are free to use as many subdirectories in that template_dir as you want,
and you are fine.
in both cases (different compile_dirs for for different template_dirs, or different subdirs in one template_dir) there is no need to use compile_ids
(smarty can distinguish the 2 templates without), and no use for cache_ids
(smarty doesn't use any, when compiling a template at all, they are used later). |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Apr 28, 2003 9:08 pm Post subject: |
|
|
My point was, if you really wanted to use one compile_dir for all of your template_dirs, you would have to use a separate compile_id for each template_dir. This is fundamentally a misuse of compile_id, so my recommendation would be to stick with a separate compile_dir for each template_dir, same as messju's mention above.
Monte |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Apr 28, 2003 9:35 pm Post subject: |
|
|
yes, monte. it seems our posts just crossed |
|
Back to top |
|
ewebzerg Smarty n00b
Joined: 27 Apr 2003 Posts: 4
|
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Tue Apr 29, 2003 9:53 am Post subject: |
|
|
Lazyness is never an excuse for poor organizational structure. It would be best to just lay it all out now in seperate dirs and not worry about the cache id's. _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
eadz Smarty Regular
Joined: 30 Apr 2003 Posts: 61 Location: Auckland, New Zealand
|
Posted: Mon May 26, 2003 2:20 am Post subject: |
|
|
messju wrote: |
$smarty->display('dir1/foo.tpl'); and then
$smarty->display('dir2/foo.tpl'); is fully okay and will lead to two distinct files below templates_c.
|
So this is the reccomended way of doing it?
I am making a program that has "themes" :
/templates/greentheme/
/templates/bluetheme/
and the theme is decided at runtime.
I did have a /templates/xxxx/compiled directory, ( and setting compile_dir and template_dir ) but it becomes cumborsome, as you have to chmod 777 the compiled directory every time you upload it, and if you have a lot of themes, it's a lot of chmoding.
So should I set my template_dir tp /templates/ and use display("greentheme/file.html") ?
If there is a cleaner solution that would be cool.. _________________ bBlog - Smarty based blogging software
I work for Webforce web site design ( Auckland, NZ ) |
|
Back to top |
|
|