SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Addict ibeblunt's Avatar
    Join Date
    Jan 2001
    Location
    Jersey City, NJ
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This might sound dumb at first but I've been trying to figure this out all day. Well for 3 hours.

    You know how in regular HTML you can type:
    /images/spacer.gif

    and it will be the same as:
    http://yoursite.com/images/spacer.gif

    Well, when I do that in PHP I get an error. I know in Cold Fusion, you had to define it in the CFAdmin, which was a pain.

    So does anyone have any advice on this?

    and since I got your attention, how do I get the mail to stop putting "sohh@sohh1.sohh.com" the FROM field in the mail?
    <///////~

    www.sohh.com

  2. #2
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In PHP when you have a / at the start of a *path* name that path is relative to the server root.

    So /images/spacer.gif might be pointing to
    C:/images/spacer.gif

    I think
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!

  3. #3
    SitePoint Addict ibeblunt's Avatar
    Join Date
    Jan 2001
    Location
    Jersey City, NJ
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right...

    'cause I really hate doing:

    ../../images

    I like to go to the top of the site and just come down.

    There's got to be a way around this.

    Steven
    <///////~

    www.sohh.com

  4. #4
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    With includes, or whenever you are using files with PHP use the entire path.
    It will be something like
    /home/username/www/folder/file.php
    Thats how i always do it unless the files are in the same dir as the one calling them.
    Its easiest in my opinion.
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!

  5. #5
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by mad-onion
    With includes, or whenever you are using files with PHP use the entire path.
    It will be something like
    /home/username/www/folder/file.php
    Thats how i always do it unless the files are in the same dir as the one calling them.
    Its easiest in my opinion.
    You should check the documentation on this because I'm just a *total* newbie to PHP (just wrote a "hello world" last night in fact!) but doesn't $DOCUMENT_ROOT provide the path to your HTML document root so that:

    /home/username/www/folder/file.php

    could be written as

    $path = "$DOCUMENTROOT . "//folder//file.php"

    Is this correct?

  6. #6
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I must be dyslexic - I'm always getting "/" and "]" confused...


    "$DOCUMENT_ROOT . /folder/filename";

  7. #7
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sometimes DOCUMENT_ROOT doesnt work how you'd expect on other servers. I have alwasy found it is is safest to use the entire path. Maybe its just one of my silly addictions.

    Now well wait for freddy to come and shoot me down like im evil....welcome to sitepoint :-)
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •