1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

trying to use include() for a private library

Discussion in 'PHP' started by chriseccles2, Oct 13, 2008.

  1. #1
    Another question which probably has a straightforward
    answer, once I know what I'm doing !
    -
    I have written a nice little library of file I/O functions
    which all work flawlessly, so I thought I'd keep them in
    a separate file (diskiolib.php) and just use the include() directive to
    bring them into my scripts.
    -
    This does not appear to have the desired effect, as no
    script with my include("diskiolib.php"); statement in it
    ever passes parsing, let alone executes ! The library file
    is in the same directory as all my scripts.
    -
    Now, I just KNOW this is going to have an easy answer from
    the experts, so I am prepared to be humbled. I keep thinking in
    terms of C's #include, for .h files, and it's hard to find the
    answer in the manual.
    -

    Chris
     
    chriseccles2, Oct 13, 2008 IP
  2. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #2
    Should be straight forward, its in the same directory as the calling script? Does it give the usual error message? Usual problem is directories. You could always use the ./ before the file to clarify.
     
    shallowink, Oct 13, 2008 IP
  3. chriseccles2

    chriseccles2 Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Many thanks, my friend.
    -
    I said it would be obvious !
    :D

    UNIX paths floor me, every time, even after years of
    messing.

    -
    Chris
     
    chriseccles2, Oct 13, 2008 IP