SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple Question On Directory Structure

    Hi,

    I'm having a play around with Ed Sullivans mArticle and have a few questions on directory structure.

    Firstly the script is set up so that the original directory structure should be mentained as most of the files have require() or include() functions with relative paths.

    These functions refer to different path type - some of which work and some of which don't.

    Generally in all my other scripts I have to define the absolute path to the file - or I get a file not found error.

    However within the mArticle scripts, all the paths are relative paths - some work and some don't.

    for example require("functions.php"); - which is in the same folder as the script which refers to it gives file not found.
    Whereas require("./config.php"); seems to get found ok.

    Now call me dumb but I've never come across the ./ prefix (with a single ".") - I know ../ means file held in the directory one down from current but what about ./ ??

    I also know that require("functions.php"); should look in the same directory as current - is there a reason why it is not finding it when it can find files be relative path prefix ./ ??

    Cheers for the help

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I haven't seen mArticle yet, but the "./" means in the current dir.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Freddie,

    Thanks for that. Should these two not be the same then:-

    require("./functions.php");
    require("functions.php);

    As I believe leaving out any prefix at all also indicated that it was held in the same current directory. Is it that php specifically needs the "./" or looks in the root folder when absent??

    If you wish to look at mAritcle I started a lok thread relating to getting a decent Article Management Script http://www.sitepointforums.com/showt...threadid=24605

    There are numerous links to suggestions in there - If you want to download mArticle get the one from the vBulliten forum - as its a newer version.

    Cheers

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They should be the same, although sometimes, they act funny and in order for you to require() a script in the same dir you may find that you need to use ./scriptname.php

    NOt sure as to why this happens.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers


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
  •