Dear all,
I'm developping my own website and I'm also a beginner althought I've already implemented few structures by my own.
At the moment I'm having a problem.
My idea is to change a frame website structure with a php structure "including" single .php files and I'm also trying to translate from italian language to at least english.
the point is: using a frame structure, the relative path for all the links are related to the position of each single file. Instead, when i use the statment "include" the relative path change accordingly to the position of the including file with all links that will not work!
can you suggest me something? how can i "fix" the path even including different files? using an other instruction or?!
javascript:emoticon(':roll:')
Rolling Eyes
thanks in advance for any help!
ciao
mauro
<? include () ?> statment and similar
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I think you're confusing a few things here. An absolute path is the same wherever you are on the given server. A relative path must change depending on where you currently are. Absolute paths in unixland start with "/"
$_SERVER['DOCUMENT_ROOT'] may be of interest. On some server's it doesn't exist, so dirname(__FILE__) or getcwd() may also be of interest too.
$_SERVER['DOCUMENT_ROOT'] may be of interest. On some server's it doesn't exist, so dirname(__FILE__) or getcwd() may also be of interest too.
refine my idea with include function!
I've thought about a solution but still not working due a bad knowledge of php. please clarify!
I define, in the mail file calling the file to include a constant
<? define('PATH','./') ?>
whilst the included file seams like this:
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<td height=75 colspan=7 align=center valign=top><div class=titolo>Benvenuti a bordo</div>
<span class=sottotitolo>Il ciber-viaggio sta per cominciare!</span></td>
</tr>
<tr>
<td width=15></td>
<td width=40% height=20 align=LEFT class=links> | <a href=PATH.guestbook/guestbookindex.php target=_parent> etc etc
but I don't know how to make the browser read the expression
<a href=PATH.guestbook/guestbookindex.php
as
<a href=./guestbook/guestbookindex.php
is it feasible, firs of all this way of use of php?
if yes, how I have to use the php tag or code?
if it works, in any main file I can define different value of path and meanwhile still using the same included code that will follow the instruction given by the constant value
if you have any idea or suggestion, please tell me!
cheers
mauro
I define, in the mail file calling the file to include a constant
<? define('PATH','./') ?>
whilst the included file seams like this:
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<td height=75 colspan=7 align=center valign=top><div class=titolo>Benvenuti a bordo</div>
<span class=sottotitolo>Il ciber-viaggio sta per cominciare!</span></td>
</tr>
<tr>
<td width=15></td>
<td width=40% height=20 align=LEFT class=links> | <a href=PATH.guestbook/guestbookindex.php target=_parent> etc etc
but I don't know how to make the browser read the expression
<a href=PATH.guestbook/guestbookindex.php
as
<a href=./guestbook/guestbookindex.php
is it feasible, firs of all this way of use of php?
if yes, how I have to use the php tag or code?
if it works, in any main file I can define different value of path and meanwhile still using the same included code that will follow the instruction given by the constant value
if you have any idea or suggestion, please tell me!
cheers
mauro
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
The posted content is of a very different variety than standard pathing. For the most part, you should only need a leading "/", not "./" as those are URL based references which work differently than file system pathing.
If the files are located at http://somesite.com/your/path/to/a/file.php, your links can normally be "/your/path/to/a/file.php" and they'll work just fine.
If the files are located at http://somesite.com/your/path/to/a/file.php, your links can normally be "/your/path/to/a/file.php" and they'll work just fine.