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.

PHP Include 4 levels deep Help Requested

Discussion in 'PHP' started by ProductivePC, Sep 14, 2008.

  1. #1
    Hello,

    I am working with a PHPbb forum. The way they are set up with PHP I can only use the <!-- INCLUDEPHP filename.php --> includes and cannot use include('filename.php'); within their templates.

    The files I need to include in the templates so that I can have my own header and footer are in my root directory. I am on a windows server.

    To make matters worse their template files are located in the following pathway:
    root/computer-repair-forums/styles/subsilver2/template/

    When using the <!-- INCLUDEPHP filename.php --> it doesn't appear that I can use any references to my include files absolute or relative to point where the file is located. If I attempt to use <!-- INCLUDEPHP ../filename.php --> then it looks for the file in root/computer-repair-forums/styles/subsilver2/template/../filename.php instead of the previous directory.

    To get around this limitation my theory is to store a php file within the template directory and reference that file from the INCLUDEPHP and inside that file, I use the include('filename.php'); function to point to my other file within the root directory.

    Question:
    On a Windows Server, how do I tell the include function to go 4 levels lower to look for the actual php file I want to include?

    I have tried:
    include('../../../../filename.php');
    include('/filename.php');
    include('../filename.php');
    include('filename.php');

    What am I doing wrong?

    Just FYI: The default include directory on my server is C:/php5 so that will be no help. If it was set to /includes or something to that effect, this would be easy.

    Thanks,

    Wayne
     
    ProductivePC, Sep 14, 2008 IP
  2. ProductivePC

    ProductivePC Peon

    Messages:
    362
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Nevermind,

    I must have been doing something wrong. The ../../../../ did work.
    Also, I can put an absolute path that I got from my ISP in there as well.

    So I can use include('../../../../filename.php');

    Wayne
     
    ProductivePC, Sep 14, 2008 IP