Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
require() directory format
Old 04-24-2008, 06:17 PM require() directory format
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
I have been having this problem for a while and so I decided to admit defeat and ask for help.
I want to go include a file that is in a different directory, but I dont know how to include a file like this.

pagesfolder
->index.php ( the file i'm including from )
includefolder
->qwerty.php

I'm trying to include qwerty.php from the index.php file but I'm pretty much confused, but I'm sure you guys are like supercoders at this stuff and will be able to give me help.
__________________
My webmaster news & tips blogs with free scripts and tutorials -
Please login or register to view this content. Registration is FREE
andyp is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-24-2008, 06:31 PM Re: require() directory format
addonchat's Avatar
Super Talker

Posts: 115
Name: Chris Duerr
Trades: 0
If I understand you correctly, it should be as simple as:

include_once('includefolder/qwerty.php');

If includefolder isn't in the same folder as your pagesfolder, you may have to backtrack. E.g.,

include_once('../includefolder/qwerty.php');

I'll often use symbolic links to point to generic folders for an application I'm designing. E.g., images/ or lib/ etc.. to make life easier allowing files to be moved/copied/linked so I don't have to edit each file that is placed in a new location.
__________________
Chris Duerr
AddonChat Java Chat Software

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
addonchat is offline
Reply With Quote
View Public Profile
 
Old 04-24-2008, 06:54 PM Re: require() directory format
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
Thanks, that did the trick!
__________________
My webmaster news & tips blogs with free scripts and tutorials -
Please login or register to view this content. Registration is FREE
andyp is offline
Reply With Quote
View Public Profile
 
Old 04-24-2008, 07:19 PM Re: require() directory format
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I'll just add that if your web server s appache, you have a PHP variable that holds the value to your web site root folder:
PHP Code:
 $_SERVER['DOCUMENT_ROOT'
I personally use that one to make my includes:
PHP Code:
 include($_SERVER['DOCUMENT_ROOT']."/libs/db/wrapper.php"); //And so on... 
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to require() directory format
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.45424 seconds with 12 queries