Closed Thread
Results 1 to 3 of 3

Thread: includes

  1. #1
    Frantic's Avatar
    Frantic is offline Learning Programmer
    Join Date
    May 2006
    Posts
    91
    Rep Power
    0

    includes

    I'm trying to have my includes in one directory and be able to link to them from anywhere, any directory level. I found these two methods to accomplish the task, I think, but I don't really understand them that well. Can someone explain?

    http://us3.php.net/ini_set

    http://www.php.net/manual/en/functio...clude-path.php

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Sionofdarkness is offline Programming Expert
    Join Date
    Jul 2006
    Posts
    383
    Rep Power
    0
    ... Yes, can someone explain?

  4. #3
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20
    i didnt look at the links because im too lazy, but ill explain what you're trying to do.

    the main thing you need to know is where the files are located in ralation to eachother; say your directory structure looks like this:

    Code:
    >Directory
         ->includes
                  -->lang.php
                  -->config.php
    
         ->admin
                  -->folder2
                          ---> file1.php
                  -->admin.php
      
        ->index.php
        ->mainfile.php
    Lets first assume you are working with mainfile.php and you want to include config.php you would do:
    Code:
    include('includes/config.php'); 
    Now lets assume you are working with admin.php and want to include config.php you would have to use the .. (two dots) for example
    Code:
    include('../includes/config.php'); 
    which basically tells php to "go back one directory and then navigate to the includes directory then include the config.php file.' Lastly lets say you are working with file1.php you would have to use 2 sets of .. (two dots) telling php to 'go back two directorys then navigate to the includes directory and include config.php'
    Code:
    include('../../includes/config.php'); 
    i think thats what you're trying to do

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 12-14-2009, 10:57 AM
  2. Simple Server Includes Malfunctioning
    By Ruined1 in forum Perl
    Replies: 2
    Last Post: 08-28-2009, 10:17 AM
  3. Replies: 4
    Last Post: 06-29-2009, 03:54 PM

Tags for this Thread

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