Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Include Files

  1. #1
    New Coder
    Join Date
    Jul 2010
    Posts
    67
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Include Files

    Hi Guys,

    Here is my code:

    PHP Code:
    <?php
    require($DOCUMENT_ROOT "header.inc");
    ?>
    How do I make this work one directory down?

    e.g. www.domain.co.uk/products/HERE.php

    Hope that males sense.

    Thanks

    Joe

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Assuming $DOCUMENT_ROOT is the actual document root, and header.inc is there, it should work.

  • #3
    New Coder
    Join Date
    Jul 2010
    Posts
    67
    Thanks
    11
    Thanked 0 Times in 0 Posts
    I have all the includes in the root of the file. But then I want to attach the same include one directory below. Does that make sense?

  • #4
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts
    Do you mean the file is in a parent folder? IE you need to go up a level to get the the file you wanna include? If so just put ../ before e.g. include("../header.inc");


  •  

    Posting Permissions

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