getcwd

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jamal
Forum Commoner
Posts: 57
Joined: Sat Oct 26, 2002 7:53 pm
Location: London

getcwd

Post 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
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post 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.
User avatar
Elmseeker
Forum Contributor
Posts: 132
Joined: Sun Dec 22, 2002 5:48 am
Location: Worcester, MA

Post 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!
Post Reply