PHP dropped in my lap...need help!

This is a discussion on PHP dropped in my lap...need help! within the PHP Language forums, part of the PHP Programming Forums category; I have to come up to speed quickly on PHP since I have been given the responsibilty of updating our ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-28-2005
DaveB
 
Posts: n/a
Default PHP dropped in my lap...need help!

I have to come up to speed quickly on PHP since I have been given the
responsibilty of updating our website.

I have setup a local web server through IIS, downloaded and installed
PHP. I'm using Dreamweaver to edit my pages. When attempting to preview
pages the include file is being read and the page is properly displayed
in the browser with the exception of images.

I think I know what the problem is, but I'm not sure how to fix it. The
include file for the image source reads as follows:

<img src="/images/header-right.jpg"

This apparently is relative to the root of the remote website but when
previewed locally the server is looking for the image here:

http://localhost/images/header-right.jpg

I need it to look here:

http://localhost/localwebsitecopy/im...ader-right.jpg

What is the best approach for me to use to allow me to properly load
these images both locally (for preview) and on the remote website?

Any help would be appreciated and please remember that you are not
talking to a programmer (I'm sure this is obvious.)

Thanks!

Dave

Reply With Quote
  #2 (permalink)  
Old 04-28-2005
aussiebob
 
Posts: n/a
Default Re: PHP dropped in my lap...need help!

DaveB wrote:
> I have to come up to speed quickly on PHP since I have been given the
> responsibilty of updating our website.
>
> I have setup a local web server through IIS, downloaded and installed
> PHP. I'm using Dreamweaver to edit my pages. When attempting to

preview
> pages the include file is being read and the page is properly

displayed
> in the browser with the exception of images.
>
> I think I know what the problem is, but I'm not sure how to fix it.

The
> include file for the image source reads as follows:
>
> <img src="/images/header-right.jpg"
>
> This apparently is relative to the root of the remote website but

when
> previewed locally the server is looking for the image here:
>
> http://localhost/images/header-right.jpg
>
> I need it to look here:
>
> http://localhost/localwebsitecopy/im...ader-right.jpg
>
> What is the best approach for me to use to allow me to properly load
> these images both locally (for preview) and on the remote website?
>
> Any help would be appreciated and please remember that you are not
> talking to a programmer (I'm sure this is obvious.)
>
> Thanks!
>
> Dave


Reply With Quote
  #3 (permalink)  
Old 04-28-2005
BKDotCom
 
Posts: n/a
Default Re: PHP dropped in my lap...need help!

You could change root of your development server so that it matches..
Or your could set up a virtual host on the dev server for the same
purpose.

Reply With Quote
  #4 (permalink)  
Old 04-28-2005
Phillip Parr
 
Posts: n/a
Default Re: PHP dropped in my lap...need help!


"DaveB" <daveboddy@yahoo.com> wrote in message
news:1114696667.972858.22250@z14g2000cwz.googlegro ups.com...
>I have to come up to speed quickly on PHP since I have been given the
> responsibilty of updating our website.
>
> I have setup a local web server through IIS, downloaded and installed
> PHP. I'm using Dreamweaver to edit my pages. When attempting to preview
> pages the include file is being read and the page is properly displayed
> in the browser with the exception of images.
>
> I think I know what the problem is, but I'm not sure how to fix it. The
> include file for the image source reads as follows:
>
> <img src="/images/header-right.jpg"

<snip>


I'm not sure about ISS, but I know my version on apache only works without
the preceeding / for example:

<img src="images/header-right.jpg">


Reply With Quote
  #5 (permalink)  
Old 04-28-2005
BKDotCom
 
Posts: n/a
Default Re: PHP dropped in my lap...need help!


Phillip Parr wrote:
> I'm not sure about ISS, but I know my version on apache only works

without
> the preceeding / for example:
>
> <img src="images/header-right.jpg">


Uh... that "only works" because the above images directory is relative
to the local path and not in the server's document root.
In your above example "./images/header-right.jpg" would also work
where the "." refers to the current directory/folder

Reply With Quote
  #6 (permalink)  
Old 04-28-2005
Sadara
 
Posts: n/a
Default Re: PHP dropped in my lap...need help!

DaveB wrote:
> I have to come up to speed quickly on PHP since I have been given the
> responsibilty of updating our website.
>
> I have setup a local web server through IIS, downloaded and installed
> PHP. I'm using Dreamweaver to edit my pages. When attempting to preview
> pages the include file is being read and the page is properly displayed
> in the browser with the exception of images.
>
> I think I know what the problem is, but I'm not sure how to fix it. The
> include file for the image source reads as follows:
>
> <img src="/images/header-right.jpg"
>
> This apparently is relative to the root of the remote website

this is not a relative path. it is simply a path. in this path, 'images'
is the name a directory immediately below the web site's document root
('/').

> but when
> previewed locally the server is looking for the image here:
>
> http://localhost/images/header-right.jpg

the server is looking for a directory named 'images' immedialtely below
the web site's document root, just as it does on your remote website.

> I need it to look here:
>
> http://localhost/localwebsitecopy/im...ader-right.jpg
>
> What is the best approach for me to use to allow me to properly load
> these images both locally (for preview) and on the remote website?

1. if you're using dreamweaver, there's no need for you to use absolute
paths (like '/images/header-right.jpg') in your local code. let
dreamweaver create relative paths for you.
2. if you're using dreamweaver, make use of the 'testing server' in the
site's setup. this will allow you to specify the site's root on your
local server for previewing purposes.

> Any help would be appreciated and please remember that you are not
> talking to a programmer (I'm sure this is obvious.)
>
> Thanks!
>
> Dave


good luck
sadara


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:05 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0