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

How do I define the main direcotry?

 
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
Fireche
Smarty n00b


Joined: 07 Jun 2015
Posts: 4

PostPosted: Sun Jun 07, 2015 8:01 pm    Post subject: How do I define the main direcotry? Reply with quote

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


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Jun 08, 2015 8:07 am    Post subject: Reply with quote

What jQuery has to do with Smarty?
Back to top
View user's profile Send private message
Fireche
Smarty n00b


Joined: 07 Jun 2015
Posts: 4

PostPosted: Mon Jun 08, 2015 9:33 am    Post subject: Reply with quote

Because via JQuery I include the header.tpl
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Jun 09, 2015 8:16 am    Post subject: Reply with quote

What you are doing is irrelevant.
I asked what it has to with it.
(Hint: Nothing, they can't interact.)
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Jun 09, 2015 5:03 pm    Post subject: Reply with quote

Any reason why you don't use
Code:
{include file='header.tpl'}
Back to top
View user's profile Send private message
Fireche
Smarty n00b


Joined: 07 Jun 2015
Posts: 4

PostPosted: Fri Jun 12, 2015 8:16 am    Post subject: Reply with quote

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


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Jun 13, 2015 6:05 pm    Post subject: Reply with quote

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
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