Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Multilang: template_dir not checked

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
FLT
Smarty n00b


Joined: 08 Mar 2004
Posts: 2

PostPosted: Mon Mar 08, 2004 3:08 pm    Post subject: Multilang: template_dir not checked Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Mar 08, 2004 4:01 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
FLT
Smarty n00b


Joined: 08 Mar 2004
Posts: 2

PostPosted: Tue Mar 09, 2004 10:34 am    Post subject: Reply with quote

That's is! Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP