Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-19-2006, 06:37 PM
Frantic's Avatar   
Frantic Frantic is offline
Learning Programmer
 
Join Date: May 2006
Posts: 92
Rep Power: 10
Frantic is on a distinguished road
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-21-2006, 04:54 PM
Sionofdarkness Sionofdarkness is offline
Programming Expert
 
Join Date: Jul 2006
Posts: 384
Rep Power: 11
Sionofdarkness is on a distinguished road
Default

... Yes, can someone explain?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-28-2006, 01:31 AM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default

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:
PHP 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
PHP 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'
PHP Code:
include('../../includes/config.php'); 
i think thats what you're trying to do
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -5. The time now is 06:03 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads