|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
FLT Smarty n00b
Joined: 08 Mar 2004 Posts: 2
|
Posted: Mon Mar 08, 2004 3:08 pm Post subject: Multilang: template_dir not checked |
|
|
Hm, I think I've found a bug. Generated templates do not enclose information about source template_dir.
Smarty settings:
Code: |
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->force_compile = false;
$smarty->debugging = false;
$smarty->config_dir = '_configs';
$smarty->template_dir = 'tmp/'.$lang;
$smarty->compile_dir = 'tmp_c';
$smarty->plugins_dir = '_plugins';
|
I've got two template dirs:
tmp/ENG
tmp/HUN
each of there dirs contain a file:
index.tpl
tmp/ENG/index.tpl contents: ENG
tmp/HUN/index.tpl contents: HUN
So, when I set $smarty->template_dir to 'tmp/ENG' and display the index.tpl template. It outputs: ENG. (note: template generated, sits in tmp_c)
Now, I directly set $smarty->template_dir to 'tmp/HUN' and it outputs: ENG instead of HUN...
The template didn't changed in tmp_c, because the template_dir variable is not compile-checked, smarty thinks it's the same index.tpl file.
When force_compile is enabled, the template is regenerated, correctly outputs: HUN, but comes with a big overhead.
The problem is around template_dir which isn't checked with the compiled templates. Because setting template_dir to 'tmp' and using
$smarty->display('HUN/index.tpl');
works correctly with both alternatives, but in my case it's a pain in the ass. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Mar 08, 2004 4:01 pm Post subject: |
|
|
Each template_dir should have its own compile_dir. If you want to mix them, set a unique compile_id for each template_dir. |
|
Back to top |
|
FLT Smarty n00b
Joined: 08 Mar 2004 Posts: 2
|
Posted: Tue Mar 09, 2004 10:34 am Post subject: |
|
|
That's is! Thanks! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|