|
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 |
Notromda Smarty Rookie
Joined: 30 Aug 2004 Posts: 13
|
Posted: Mon Aug 30, 2004 9:28 pm Post subject: multiple compiles for one file |
|
|
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 |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Aug 30, 2004 9:41 pm Post subject: |
|
|
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 |
|
Notromda Smarty Rookie
Joined: 30 Aug 2004 Posts: 13
|
Posted: Mon Aug 30, 2004 9:46 pm Post subject: |
|
|
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 |
|
Notromda Smarty Rookie
Joined: 30 Aug 2004 Posts: 13
|
Posted: Mon Aug 30, 2004 9:56 pm Post subject: FIXED |
|
|
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 |
|
|
|
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
|