niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » PHP
relative path / absolute path
Post new topic   Reply to topic Page 1 of 2 [20 Posts] View previous topic :: View next topic
Goto page:  1, 2 Next
Author Message
Jerry Stuckle
*nix forums Guru


Joined: 24 Feb 2005
Posts: 1515

PostPosted: Sun Jun 25, 2006 6:18 pm    Post subject: Re: |OT| Re: relative path / absolute path Reply with quote

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

PostPosted: Sun Jun 25, 2006 5:33 pm    Post subject: |OT| Re: relative path / absolute path Reply with quote

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

PostPosted: Tue Jun 20, 2006 4:34 pm    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Tue Jun 20, 2006 2:44 pm    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Tue Jun 20, 2006 1:11 am    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Mon Jun 19, 2006 3:06 pm    Post subject: Re: relative path / absolute path Reply with 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.

--

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

PostPosted: Mon Jun 19, 2006 12:16 pm    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Mon Jun 19, 2006 7:25 am    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Mon Jun 19, 2006 5:26 am    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Mon Jun 19, 2006 4:24 am    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Mon Jun 19, 2006 12:21 am    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Mon Jun 19, 2006 12:18 am    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Sun Jun 18, 2006 11:45 pm    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Sun Jun 18, 2006 11:21 pm    Post subject: Re: relative path / absolute path Reply with quote

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

PostPosted: Sun Jun 18, 2006 10:34 pm    Post subject: Re: relative path / absolute path Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 2 [20 Posts] Goto page:  1, 2 Next
View previous topic :: View next topic
The time now is Fri Jan 09, 2009 10:10 pm | All times are GMT
navigation Forum index » Programming » PHP
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts User Environment - export PATH variable paalepu AIX 0 Tue Sep 12, 2006 8:12 pm
No new posts How to set a session cookie with a path? John Drako PHP 1 Thu Jul 20, 2006 7:32 pm
No new posts long path names for ifstream in( Fred J. C++ 1 Thu Jul 20, 2006 2:06 am
No new posts File manager for creating relative symbolic links Tony Terlecki Debian 1 Wed Jul 19, 2006 2:20 pm
No new posts how to use Env variables & its path in ksh shell script dalu.gelu@gmail.com shell 8 Tue Jul 18, 2006 1:12 pm

Car Credit | Mobile Phones | Watch Anime Free Online | Loans | Credit Cards
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.3059s ][ Queries: 16 (0.1647s) ][ GZIP on - Debug on ]