Simon Cripps
asked on
Finding the root Link
I'm having a bit of trouble geting my head arround relative links.
I use a template in dreamweaver which points to a file, within a php function" named "../../Community/NewsRss/G oogle_Feed .xsl" .
Now if the template is used in a file which is located in the /NewRSS folder it can read the XML file, however if it is in the root folder I get the message "The specified file ../../Community/NewsRss/Go ogle_Feed. xsl could not be found."
I would have thought that ../../ would work where ever.
Any clues to where I am going wrong.
I use a template in dreamweaver which points to a file, within a php function" named "../../Community/NewsRss/G
Now if the template is used in a file which is located in the /NewRSS folder it can read the XML file, however if it is in the root folder I get the message "The specified file ../../Community/NewsRss/Go
I would have thought that ../../ would work where ever.
Any clues to where I am going wrong.
ASKER
Part fixed, part broke.
If I use "./Community/NewsRss/Googl e_Feed.xsl " in the template then files in the root directory are able to read the file but not in the NewsRSS folder.
However for this to work on files in the NewsRSS folder I need to change the template to "../../Community/NewsRss/G oogle_Feed .xsl" .
The problem is that as this for two pages, in different folders, using the same template I have to use one or another. Do you know why "./" works in the root folder and "../../" NewsRSS folder.
If I use "./Community/NewsRss/Googl
However for this to work on files in the NewsRSS folder I need to change the template to "../../Community/NewsRss/G
The problem is that as this for two pages, in different folders, using the same template I have to use one or another. Do you know why "./" works in the root folder and "../../" NewsRSS folder.
- Just to be sure: is it NewsRSS or NewsRss? Unix is case sensitive, while it does not matter under Windows
- The path thing.
It depends on where you are.
-- If you are in the root folder, then 'mydir', './mydir' and '/mydir' all point to the same place.
-- If you are in /mydir folder, then 'mydir1', './mydir1', '/mydir/mydir1' and '../mydir/mydir1' all point to the same place.
When the address start with / then this is an "absolute" address and is given relative to the root
In all other cases the adress is relative to the current directory, for which the conventional shortcut is a single dot '.'
The 'father' directory of the current directory is conventionally '..'
This is why it is coherent that in root "./Community/NewsRss/Googl e_Feed.xsl " works fine while in directories 2 levels under, such as NewsRss you need '../../' (to go up 2 levels).
What happens when you use in both situations "/Community/NewsRss/Google _Feed.xsl" ?
- The path thing.
It depends on where you are.
-- If you are in the root folder, then 'mydir', './mydir' and '/mydir' all point to the same place.
-- If you are in /mydir folder, then 'mydir1', './mydir1', '/mydir/mydir1' and '../mydir/mydir1' all point to the same place.
When the address start with / then this is an "absolute" address and is given relative to the root
In all other cases the adress is relative to the current directory, for which the conventional shortcut is a single dot '.'
The 'father' directory of the current directory is conventionally '..'
This is why it is coherent that in root "./Community/NewsRss/Googl
What happens when you use in both situations "/Community/NewsRss/Google
ASKER
All makes complete sence, but does not appear to work. if I use "/Community/NewsRss/Google _Feed.xsl" then the error appears in the pages in both locations.
So I still need to refer to ./Community/NewsRSS/ folder in root and ../../Community/NewsRSS/ from the NewsRSS folder.
Could it be because these are being defined in PHP?
So I still need to refer to ./Community/NewsRSS/ folder in root and ../../Community/NewsRSS/ from the NewsRSS folder.
Could it be because these are being defined in PHP?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This may also be as I am using the parameter in dreamweaver MM_XSLTransform() rss reader. as this does not affect any other of my links in the template. I now set the directory in the editable area at the top of the template so I can change it for each page
B-)) glad this is solved. Thx for the points and grade
Now if you are using from 2 levels above, you should use instead "./Community/NewsRss/Googl
And if this "2level above" is also the home/root dir, then "/Community/NewsRss/Google