Hello All
I am currently reworking a past project and am getting rid of most of the procedural code and replacing it with classes. everything is going quite well but the paths are driving me nuts. I am trying to use one consistent solution for all links and include files but every variation I try seems to have an issue somewhere. I will run down what I have tried and see what your suggestions are.
1) page relative:
this doesn't work when I am more than 1 folder deep. I have a loader class that does not currently account for how many folders deep the call is benig made from.Code:include('../classes/myClass.php');
2) root relative i.e.
This includes properly from where ever it is called, but then I have a problem with instantiating.Code:include('/myproject/classes/myClass.php');
This gives me an error saying that the myClass class cannot be found. I have looked around but have no clue why this is happening.Code:include('/myproject/classes/myClass.php'); myClass = new myClass;
3) absolute paths
the includes work fine but my sessions went haywire when I went to this method. My login page does not work anymore and I beleive it is because it is setting 2 different session id's - one for the login page and another when it redirects to the rest of the site.Code:include('c:/wamp/www/myProject/classes/myClass.php');
Does that make sense?
Thanks
Matt







Bookmarks