|
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 |
bird Smarty n00b
Joined: 16 Jun 2003 Posts: 2
|
Posted: Mon Jun 16, 2003 1:15 pm Post subject: templates & multiversion site |
|
|
I create site on Smarty. Site have several language versions.
For each version I create directory for temlates. Template names have identical names (for example "version_1/index.tmpl" & "version_2/index.tmpl"). Both versions processes with one file (index.phtml).
Some code from index.phtml:
$Version = new Version(array("id"=>$_GET["id"]));
$Output = new Smarty;
$smarty->template_dir = "/...fullpath.../version_".$Version->id";
$smarty->display("index.tmpl");
Than if I get "http://mysite.com/index.phtml?id=1", Smarty compile index.tmpl for version with index=1.
and
get "http://mysite.com/index.phtml?id=2", but Smarty ignore this input and don't compile template because it is already compiled!
I expect that Smarty does not trace the full path to template when compiling.
PS. Smarty version 2.5.0 & sorry for my english |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Jun 16, 2003 1:37 pm Post subject: |
|
|
AFAIK, If you are going to setup your template usage the way you have, you will have to setup multiple template_c directory as well.
Otherwise, this might work:
$smarty->display("index.tmpl", $cache_id, $Version);
That should cause each template version to result in a different $compile_id (the last parameter to $smarty->display). You don't have to set a value for $cache_id if you aren't going to use multiple caches. The manual has more to say about $compile_id. |
|
Back to top |
|
bird Smarty n00b
Joined: 16 Jun 2003 Posts: 2
|
Posted: Mon Jun 16, 2003 3:19 pm Post subject: |
|
|
Oh!
I forget about multiplie cashes.
Thanks for your help boots! |
|
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
|