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

multiple compiles for one file

 
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 -> General
View previous topic :: View next topic  
Author Message
Notromda
Smarty Rookie


Joined: 30 Aug 2004
Posts: 13

PostPosted: Mon Aug 30, 2004 9:28 pm    Post subject: multiple compiles for one file Reply with quote

I am working on an MVC framework using Smarty templates, similar in style to Ruby on Rails http://www.rubyonrails.org

I pass in some arguments to a dispatcher like this:

http://hostname/index.php?module=foo&action=index

This ends up loading a template named ./views/foo/index.tpl

if I use another modulenamed bar, it should load ./views/bar/index.tpl

The problem is that the compiled versions overlap, and so I don't get the right output. How do I go about fix this? Do I need to specify a different compile directory for each controller?
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Mon Aug 30, 2004 9:41 pm    Post subject: Reply with quote

They shouldn't overlap if each template has a unique path under the templates dir. If you are using multiple template dirs, then you will also need multiple compile dirs to avoid collisions.

So given the single template_dir = '/view/', templates 'foo/index' and 'bar/index' should each result in different compile files.
Back to top
View user's profile Send private message
Notromda
Smarty Rookie


Joined: 30 Aug 2004
Posts: 13

PostPosted: Mon Aug 30, 2004 9:46 pm    Post subject: Reply with quote

boots wrote:

So given the single template_dir = '/view/', templates 'foo/index' and 'bar/index' should each result in different compile files.


Ah... I think I'm setting up a different template_dir for each controller; which means I need a different compile dir too, or I need to refactor where I specify the view directory.
Back to top
View user's profile Send private message
Notromda
Smarty Rookie


Joined: 30 Aug 2004
Posts: 13

PostPosted: Mon Aug 30, 2004 9:56 pm    Post subject: FIXED Reply with quote

indeed, that fixed it. I moved the logic about the subdirectory up a ways to the display() call, and everything is working better. 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 -> General 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