473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[Q] obtaining relative paths within a html page?




I have a root directory with 1 subdirectory(myphoto), and 2 files.
Inside the myphoto subdirectory, I have 1 html page and another image.

Root dir:
<myphoto>
01.jpg
watermark.php
myphoto:
indexpage.html
01.jpg
Inside indexpage.html, I have a link like this, which calls the
watermark.php in the root directory and passes it a parameter of a
filename.

<a href="../watermark.php?src=01.jpg" target="">my watermarked
image</a>
However, in this case, watermark.php is passed the 01.jpg which is in
the root directory.

Instead of this, I want it to be passed the 01.jpg from the myphoto
subdirectory. I can solve the problem easily if I code in the absolute
path, but I want
to stay with relative paths, since I may change directory names quiet
often.

How can I solve this problem?
Jul 23 '05 #1
3 1589
On Wed, 09 Feb 2005 00:57:33 GMT, te**@gesg.com (Sir Loin of Beef)
wrote:
I have a root directory with 1 subdirectory(myphoto), and 2 files.
Inside the myphoto subdirectory, I have 1 html page and another image.

Root dir:
<myphoto>
01.jpg...


[bla, bla bla]

And this relates to an (X)HTML problem of yours in some way?

--
Rex
Jul 23 '05 #2
Previously in comp.infosystems.www.authoring.html, Sir Loin of Beef
<te**@gesg.com> said:
<a href="../watermark.php?src=01.jpg" target="">my watermarked
image</a>

However, in this case, watermark.php is passed the 01.jpg which is in
the root directory.

Instead of this, I want it to be passed the 01.jpg from the myphoto
subdirectory. How can I solve this problem?


Change your php code to look in the myphoto directory for the filename
you pass it. Then if you ever change the directory, you only have to
change it in the php, rather than on every link.

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 23 '05 #3
Sir Loin of Beef wrote:
to stay with relative paths, since I may change directory names quiet
often.


Why would you ever want to change your directory paths so often? Doing
so is very likely to also change the URI, which is very bad practice.
Have you not heard that Cool URIs Don't Change? Think before you
publish and directories won't need to change.

http://www.w3.org/QA/Tips/uri-choose
http://www.w3.org/QA/Tips/uri-manage
http://www.w3.org/Provider/Style/URI

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: jason | last post by:
Can anyone help me find a solution to quickly working out relative paths to a folder in the root of my server... Although it easy when you go - say - two levels down: .../includes it...
15
by: Nick K. | last post by:
I recently began maintenance work on a production web server that is located in the root directory of a web server. I moved this into a sub web on my local web server in order to do work on it. I...
3
by: epigram | last post by:
I've got a javascript menu that uses an external .js file. In the .js file, there is a function that gets called by each of my .html pages to build up the menu for the page. The way I want to...
2
by: Alex | last post by:
Hi. I need some help on this. I have a user control (a header) in my root directory, and all my pages use that control. Then a created a folder (in my root directory) and put a new page inside it,...
2
by: Steve Franks | last post by:
I am familiar with the fact that you have to use runat=server and links staring with "~/" to ensure proper mapping of paths to relative URLs when using master pages. However this does not seem to...
11
by: MBS | last post by:
I am playing around with some PHP code. I want to put in an include() function so I can include existing HTML code and output it to the browser. Lo and behold PHP does not support relative paths...
3
by: yan | last post by:
Hello everybody, I am new so this is the occasion to say hello to everybody. I have a problem with absolute/relative paths. I have to create a static documentation in html for a project and I have...
1
by: Anees | last post by:
hi i was trying to implement mode rewrite option in a blog site. i used the lines for listing the posts by its topic category as #List by Category RewriteRule ^Topics/(+)$ index.php?cat=$1 ...
15
by: Lars Eighner | last post by:
Aside from the deaths of a few extra electrons to spell out the whole root relative path, is there any down side? It seems to me that theoretically it shouldn't make any difference, and it would...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.