|
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 |
Fireche Smarty n00b
Joined: 07 Jun 2015 Posts: 4
|
Posted: Sun Jun 07, 2015 8:01 pm Post subject: How do I define the main direcotry? |
|
|
Hello,
how exactly do I define the main directory so I have no problems accessing it from every file nevermind how nested it is?
The problem is that I have an index.php and all the other php files are in a folder called php:
index.php
->php
-->x.php
-->y.php
-->z.php
/smarty
->templates
-->index.tpl
-->x.tpl
-->y.tpl
-->z.tpl
-->header.tpl
I am including the header.tpl in every other .tpl file:
<script>
$(function(){
$("#header").load("Smarty/templates/header.tpl");
});
</script>
now obviously the path in the load function only applies for the index.php. To make it work for the others the path should be called "../Smarty/templates/header.tpl".
I think something like {$main_directory]Smarty/templates/header.tpl would solve it but I tried to define the variable but it all didnt work.
Thank you!
cheers |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Jun 08, 2015 8:07 am Post subject: |
|
|
What jQuery has to do with Smarty? |
|
Back to top |
|
Fireche Smarty n00b
Joined: 07 Jun 2015 Posts: 4
|
Posted: Mon Jun 08, 2015 9:33 am Post subject: |
|
|
Because via JQuery I include the header.tpl |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jun 09, 2015 8:16 am Post subject: |
|
|
What you are doing is irrelevant.
I asked what it has to with it.
(Hint: Nothing, they can't interact.) |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Jun 09, 2015 5:03 pm Post subject: |
|
|
Any reason why you don't use
Code: | {include file='header.tpl'} |
|
|
Back to top |
|
Fireche Smarty n00b
Joined: 07 Jun 2015 Posts: 4
|
Posted: Fri Jun 12, 2015 8:16 am Post subject: |
|
|
U.Tews wrote: | Any reason why you don't use
Code: | {include file='header.tpl'} |
|
I could do that. Thanks. But I still have the problem then that the path in the header.tpl for the css file is incorrect for some files. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Jun 13, 2015 6:05 pm Post subject: |
|
|
If you use a relative path for your CSS files it must be relative to the webroot, not to the Smarty installation |
|
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
|