|
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 |
myov Smarty n00b
Joined: 29 Mar 2004 Posts: 3
|
Posted: Mon Mar 29, 2004 4:32 am Post subject: include files |
|
|
How can I tell smarty to use body.html from the current directory?
My directory structure is:
folder1/index.php
folder1/body.html
My smarty template uses the body.html content in the right place.
But, when I created folder2 with the same structure, it started using folder1's content.
Can this be done? |
|
Back to top |
|
ShenKong Smarty Rookie
Joined: 20 Jan 2004 Posts: 27
|
|
Back to top |
|
myov Smarty n00b
Joined: 29 Mar 2004 Posts: 3
|
Posted: Mon Mar 29, 2004 7:21 am Post subject: |
|
|
didn't work. folder 1 worked (which is now the root), folder 2 worked, but going back to the root used folder2's content.
I'm guessing it's because the filenames are the same, so when Smarty compiles the page it uses the wrong one.
Is it possible to do the include from a variable? ie:
{include file="$pathToFile"}
Then I could just pass that in to the template. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Mar 29, 2004 7:29 am Post subject: |
|
|
Yes you can include dynamically--use that [actually, one of my favourite techniques]
It appears that your problem is that you have a single compile_dir for multiple template_dir's which each have the same file layout. It occurs to me that there are some threads related to that here at the forum, but I could not find them easily.
It also appears that your problem arises because you are point your template dir to your webroot (and perhaps your compiled and cached dirs as well). This is not recommended and if possible, you should restructure your app (again, threads are available here and it is a topic available from a good google search as well ). |
|
Back to top |
|
myov Smarty n00b
Joined: 29 Mar 2004 Posts: 3
|
Posted: Mon Mar 29, 2004 7:43 am Post subject: |
|
|
n/m, figured out that the answer is yes |
|
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
|