Page 1 of 1

getcwd

Posted: Mon Jan 06, 2003 8:23 pm
by jamal
common_db.inc
This path looks urgly.

Code: Select all

include ("c:\\inetpub\\wwwroot\\cookBook\\recipes\\lib\\Cookbook.php");
include ("c:\\inetpub\\wwwroot\\cookBook\\recipes\\lib\\Cookbook_Utils.php");
include ("c:\\inetpub\\wwwroot\\cookBook\\recipes\\lib\\Cookbook_Webutils.php");
include ("c:\\inetpub\\wwwroot\\cookBook\\recipes\\lib\\Cookbook_Session.php");
Can anyone show me how to how use getcwd()to get the source ???
And I would not mind if there is any other method to go about it.
My intend is to use a file to keep all path in the root of the server and call it
with a function.
How can I do this please???
Thanks

Posted: Mon Jan 06, 2003 10:26 pm
by mydimension
not exactly sure what your asking for. i think your asking if there is a better/cleaner/nicer looking way to include those four files.

Posted: Mon Jan 06, 2003 11:40 pm
by Elmseeker
Have you tried using a variable? like:

Code: Select all

<?php
$rootdir = "c:\\inetpub\\wwwroot\\cookBook\\recipes\\lib";
include ("$rootdir\\Cookbook.php");
include ("$rootdir\\Cookbook_Utils.php"); 
include ("$rootdir\\Cookbook_Webutils.php"); 
include ("$rootdir\\Cookbook_Session.php");  
?>
If it's just cwd you want (which you'd have to basically use above methond anyway) you can get all the info on it at http://www.php.net/getcwd. Hope this helps, Enjoy!