Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

templates & multiversion site

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
bird
Smarty n00b


Joined: 16 Jun 2003
Posts: 2

PostPosted: Mon Jun 16, 2003 1:15 pm    Post subject: templates & multiversion site Reply with quote

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


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Mon Jun 16, 2003 1:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
bird
Smarty n00b


Joined: 16 Jun 2003
Posts: 2

PostPosted: Mon Jun 16, 2003 3:19 pm    Post subject: Reply with quote

Oh!
I forget about multiplie cashes.
Thanks for your help boots!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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