| Author |
Message |
Jerry Stuckle *nix forums Guru
Joined: 24 Feb 2005
Posts: 1515
|
Posted: Sun Jun 25, 2006 6:18 pm Post subject:
Re: |OT| Re: relative path / absolute path
|
|
|
R. Rajesh Jeba Anbiah wrote:
| Quote: | Jerry Stuckle wrote:
R. Rajesh Jeba Anbiah wrote:
snip
Glad to see professor after long time; hope economy is fine
there. I don't understand what sort of problem are you facing. But, in
HTML instead of using <img src="/images/..." />, if you use <img
src="images/..." /> you'll be better off.
Doesn't validate in HTML 4.01 (strict or transitional).
So, instead of "images/..", if we use "/images/.." will it
validate?
The problem is:
img src="images/..." /
^
This is valid for xml but not html.
LOL.
--
?php echo 'Just another PHP saint'; ?
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
|
Try running it through an HTML validator. Or show me exactly where in the HTML
specs it says this is valid.
You can't - because it's not valid.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
================== |
|
| Back to top |
|
 |
R. Rajesh Jeba Anbiah *nix forums Guru
Joined: 11 Mar 2005
Posts: 528
|
Posted: Sun Jun 25, 2006 5:33 pm Post subject:
|OT| Re: relative path / absolute path
|
|
|
Jerry Stuckle wrote:
| Quote: | R. Rajesh Jeba Anbiah wrote:
snip
Glad to see professor after long time; hope economy is fine
there. I don't understand what sort of problem are you facing. But, in
HTML instead of using <img src="/images/..." />, if you use <img
src="images/..." /> you'll be better off.
Doesn't validate in HTML 4.01 (strict or transitional).
So, instead of "images/..", if we use "/images/.." will it
validate?
The problem is:
img src="images/..." /
^
This is valid for xml but not html.
|
LOL.
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
| Back to top |
|
 |
Jerry Stuckle *nix forums Guru
Joined: 24 Feb 2005
Posts: 1515
|
Posted: Tue Jun 20, 2006 4:34 pm Post subject:
Re: relative path / absolute path
|
|
|
R. Rajesh Jeba Anbiah wrote:
| Quote: | Jerry Stuckle wrote:
snip
Glad to see professor after long time; hope economy is fine
there. I don't understand what sort of problem are you facing. But, in
HTML instead of using <img src="/images/..." />, if you use <img
src="images/..." /> you'll be better off.
Doesn't validate in HTML 4.01 (strict or transitional).
So, instead of "images/..", if we use "/images/.." will it
validate?
--
?php echo 'Just another PHP saint'; ?
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
|
The problem is:
<img src="images/..." />
^
This is valid for xml but not html.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
================== |
|
| Back to top |
|
 |
R. Rajesh Jeba Anbiah *nix forums Guru
Joined: 11 Mar 2005
Posts: 528
|
Posted: Tue Jun 20, 2006 2:44 pm Post subject:
Re: relative path / absolute path
|
|
|
Jerry Stuckle wrote:
<snip>
| Quote: | Glad to see professor after long time; hope economy is fine
there. I don't understand what sort of problem are you facing. But, in
HTML instead of using <img src="/images/..." />, if you use <img
src="images/..." /> you'll be better off.
Doesn't validate in HTML 4.01 (strict or transitional).
|
So, instead of "images/..", if we use "/images/.." will it
validate?
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
| Back to top |
|
 |
Jerry Stuckle *nix forums Guru
Joined: 24 Feb 2005
Posts: 1515
|
Posted: Tue Jun 20, 2006 1:11 am Post subject:
Re: relative path / absolute path
|
|
|
Jerry M. Gartner wrote:
| Quote: | I understand that this is a php group. Thus the post. The question is
relevant to php as I am writing a rather ugly php application - the post
from Jan was just what I was looking for. I appreciate everyone's input.
|
So, what's your PHP question? The only one you asked was about the <img> tag -
which is HTML, not PHP.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
================== |
|
| Back to top |
|
 |
Jerry M. Gartner *nix forums beginner
Joined: 22 Aug 2005
Posts: 22
|
Posted: Mon Jun 19, 2006 3:06 pm Post subject:
Re: relative path / absolute path
|
|
|
I understand that this is a php group. Thus the post. The question is
relevant to php as I am writing a rather ugly php application - the post
from Jan was just what I was looking for. I appreciate everyone's input.
--
Regards,
Jerry M. Gartner
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:rrWdnYXXsKRASQjZnZ2dnUVZ_t2dnZ2d@comcast.com...
| Quote: | Jerry M. Gartner wrote:
Greetings:
What is the best way to resolve paths within a document regardless of
what path it is opened under? For example: I have x.php and it contains
img src="images...">, (amongst other things, like php code), which
resolves the correct image path when opened under / but when x.php is
read into a file under /dir the image no longer resolves, for obvious
reasons. With absolute paths, this isn't an issue but it is with
relative paths. Although I can think of a kludge, or two, I figure that
there is a more elegant solution. Thanks in advance.
First of all, this isn't a PHP question - <img statements are html,
whether they're included in PHP or not. Now - if you were talking about
include(), require_once(), etc., you 'd be talking php.
The easiest way I've found is to just use absolute URL's for the images -
i.e.
img src="/images..."
Works everyplace on the site and you don't need to include extra files.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
================== |
|
|
| Back to top |
|
 |
Jerry Stuckle *nix forums Guru
Joined: 24 Feb 2005
Posts: 1515
|
Posted: Mon Jun 19, 2006 12:16 pm Post subject:
Re: relative path / absolute path
|
|
|
R. Rajesh Jeba Anbiah wrote:
| Quote: | Geoff Berrow wrote:
Message-ID: <rrWdnYXXsKRASQjZnZ2dnUVZ_t2dnZ2d@comcast.com> from Jerry
Stuckle contained the following:
The easiest way I've found is to just use absolute URL's for the images - i.e.
img src="/images..."
Works everyplace on the site and you don't need to include extra files.
I've always found a problem with that when working offline. How do you
get around that?
Glad to see professor after long time; hope economy is fine
there. I don't understand what sort of problem are you facing. But, in
HTML instead of using <img src="/images/..." />, if you use <img
src="images/..." /> you'll be better off.
--
?php echo 'Just another PHP saint'; ?
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
|
Doesn't validate in HTML 4.01 (strict or transitional).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
================== |
|
| Back to top |
|
 |
Andy Jeffries *nix forums Guru Wannabe
Joined: 15 Apr 2005
Posts: 208
|
Posted: Mon Jun 19, 2006 7:25 am Post subject:
Re: relative path / absolute path
|
|
|
On Sun, 18 Jun 2006 20:18:19 -0400, Jerry Stuckle wrote:
| Quote: | The easiest way I've found is to just use absolute URL's for the images
- i.e.
img src="/images..."
Works everyplace on the site and you don't need to include extra files.
I've always found a problem with that when working offline. How do you
get around that?
Don't know what problem you would have, unless you're trying to load the
file directly instead of through a webserver.
I always use a webserver for testing, though. Even have one going on my
main development system.
|
Exactly, particularly as this is a PHP newsgroup - the next complaint will
be "when I work offline, my PHP doesn't execute, it just prints the
source code" :-)
Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos |
|
| Back to top |
|
 |
R. Rajesh Jeba Anbiah *nix forums Guru
Joined: 11 Mar 2005
Posts: 528
|
Posted: Mon Jun 19, 2006 5:26 am Post subject:
Re: relative path / absolute path
|
|
|
Geoff Berrow wrote:
| Quote: | Message-ID: <rrWdnYXXsKRASQjZnZ2dnUVZ_t2dnZ2d@comcast.com> from Jerry
Stuckle contained the following:
The easiest way I've found is to just use absolute URL's for the images - i.e.
img src="/images..."
Works everyplace on the site and you don't need to include extra files.
I've always found a problem with that when working offline. How do you
get around that?
|
Glad to see professor after long time; hope economy is fine
there. I don't understand what sort of problem are you facing. But, in
HTML instead of using <img src="/images/..." />, if you use <img
src="images/..." /> you'll be better off.
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |
|
| Back to top |
|
 |
chernyshevsky@hotmail.com *nix forums Guru
Joined: 09 Mar 2005
Posts: 871
|
Posted: Mon Jun 19, 2006 4:24 am Post subject:
Re: relative path / absolute path
|
|
|
Jan Thomä wrote:
| Quote: | Well to be on the safe side use absolute paths, this will definitely work.
To keep your scripts maintainable, make a configuration file where you will
put the paths in. E.g
config.php
$IMG_BASE_URL="http://www.my-domain.com/images/";
|
If you have ever had to use a reverse-proxy on a web application, you'd
realize what an evil absolute paths are. |
|
| Back to top |
|
 |
Bent Stigsen *nix forums Guru Wannabe
Joined: 07 Mar 2005
Posts: 113
|
Posted: Mon Jun 19, 2006 12:21 am Post subject:
Re: relative path / absolute path
|
|
|
Geoff Berrow wrote:
| Quote: | Message-ID: <rrWdnYXXsKRASQjZnZ2dnUVZ_t2dnZ2d@comcast.com> from Jerry
Stuckle contained the following:
The easiest way I've found is to just use absolute URL's for the images -
i.e.
img src="/images..."
Works everyplace on the site and you don't need to include extra files.
I've always found a problem with that when working offline. How do you
get around that?
|
Aah, easily "fixed": DocumentRoot "/"
:)
--
/Bent |
|
| Back to top |
|
 |
Jerry Stuckle *nix forums Guru
Joined: 24 Feb 2005
Posts: 1515
|
Posted: Mon Jun 19, 2006 12:18 am Post subject:
Re: relative path / absolute path
|
|
|
Geoff Berrow wrote:
| Quote: | Message-ID: <rrWdnYXXsKRASQjZnZ2dnUVZ_t2dnZ2d@comcast.com> from Jerry
Stuckle contained the following:
The easiest way I've found is to just use absolute URL's for the images - i.e.
img src="/images..."
Works everyplace on the site and you don't need to include extra files.
I've always found a problem with that when working offline. How do you
get around that?
|
Don't know what problem you would have, unless you're trying to load the file
directly instead of through a webserver.
I always use a webserver for testing, though. Even have one going on my main
development system.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
================== |
|
| Back to top |
|
 |
Geoff Berrow *nix forums Guru
Joined: 19 Feb 2005
Posts: 491
|
Posted: Sun Jun 18, 2006 11:45 pm Post subject:
Re: relative path / absolute path
|
|
|
Message-ID: <rrWdnYXXsKRASQjZnZ2dnUVZ_t2dnZ2d@comcast.com> from Jerry
Stuckle contained the following:
| Quote: | The easiest way I've found is to just use absolute URL's for the images - i.e.
img src="/images..."
Works everyplace on the site and you don't need to include extra files.
|
I've always found a problem with that when working offline. How do you
get around that?
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/ |
|
| Back to top |
|
 |
Geoff Muldoon *nix forums addict
Joined: 23 Mar 2005
Posts: 88
|
Posted: Sun Jun 18, 2006 11:21 pm Post subject:
Re: relative path / absolute path
|
|
|
jstucklex@attglobal.net says...
| Quote: | Jerry M. Gartner wrote:
What is the best way to resolve paths within a document regardless of what
path it is opened under? For example: I have x.php and it contains <img
src="images...">, (amongst other things, like php code), which resolves the
correct image path when opened under / but when x.php is read into a file
under /dir the image no longer resolves, for obvious reasons. With absolute
paths, this isn't an issue but it is with relative paths. Although I can
think of a kludge, or two, I figure that there is a more elegant solution.
Thanks in advance.
First of all, this isn't a PHP question - <img statements are html, whether
they're included in PHP or not. Now - if you were talking about include(),
require_once(), etc., you 'd be talking php.
The easiest way I've found is to just use absolute URL's for the images - i.e.
img src="/images..."
Works everyplace on the site and you don't need to include extra files.
|
And in some circumstances (particularly with images) will result in more
efficient client-side caching.
GM |
|
| Back to top |
|
 |
Jerry Stuckle *nix forums Guru
Joined: 24 Feb 2005
Posts: 1515
|
Posted: Sun Jun 18, 2006 10:34 pm Post subject:
Re: relative path / absolute path
|
|
|
Jerry M. Gartner wrote:
| Quote: | Greetings:
What is the best way to resolve paths within a document regardless of what
path it is opened under? For example: I have x.php and it contains <img
src="images...">, (amongst other things, like php code), which resolves the
correct image path when opened under / but when x.php is read into a file
under /dir the image no longer resolves, for obvious reasons. With absolute
paths, this isn't an issue but it is with relative paths. Although I can
think of a kludge, or two, I figure that there is a more elegant solution.
Thanks in advance.
|
First of all, this isn't a PHP question - <img statements are html, whether
they're included in PHP or not. Now - if you were talking about include(),
require_once(), etc., you 'd be talking php.
The easiest way I've found is to just use absolute URL's for the images - i.e.
<img src="/images...">
Works everyplace on the site and you don't need to include extra files.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
================== |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|