Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-22-2007, 12:42 PM   PM User | #1
stfc_boy
Regular Coder

 
Join Date: Jun 2007
Posts: 310
Thanks: 86
Thanked 3 Times in 3 Posts
stfc_boy is an unknown quantity at this point
Set an inclue path?

Hi All,

I have a file called header.php which I call into various pages on my site. In it I want to link to a file called process.php

Now this file lives in a folder in the top level called connections

PHP Code:
<?php
 ini_set
('include_path''/connections');
 include(
'process.php'); 
 
?>
So the plan is if I’m calling header.php in a page from anywhere on a page that could be within a folder and then within another folder it will still work. However it does not?

Any ideas?

Thanks
stfc_boy is offline   Reply With Quote
Old 11-22-2007, 04:25 PM   PM User | #2
phpBuddy
New Coder

 
Join Date: Nov 2007
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
phpBuddy is an unknown quantity at this point
There are 2 special functions for this.
Vaiants of ini_set() / ini_get()

http://php.net/get_include_path
http://php.net/set_include_path
Can be combined to (temporary just for script) add paths to the include setting.
PHP Code:
<?php

// separator
$sep ';'// For Windows
//$sep = ':'; //for Unix, Linux

// new path(s) without ending slash
$addpath1 'C:/Apache/htdocs/connections';
$addpath2 'C:/Apache/htdocs/templates';
set_include_pathget_include_path() . $sep $addpath1 $sep $addpath2 );

include(
'process.php'); // in the '/connections' directory

?>
__________________
echo "PHP 5.2.5";
exit ( "Script End" );
phpBuddy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 06:55 PM.


Advertisement
Log in to turn off these ads.