nested include in php
- by aeonsleo
The directory structure:
C:/wamp/www/application/model/data_access/data_object.php
C:/wamp/www/application/model/users/user.class.php
C:/wamp/www/application/controller/projects.php
C:/wamp/www/application/controller/links/links.php
I have 2 php files data_object.php and user.class.php Now user.class.php has an include statement for data_object.php wchih is relative to user.class.php.These two files are under different directory hierarchy. Now I have to include this user.class.php in various files (like projects.php, links.php-which themselves are under different hierarchy) whenever i want to create a User() object.
The problem is the relative path for file inclusion of data_object.php does work for say projects.php but if i open links.php the error message says it could not open file data_object.php in user.class.php. What i think is for relative inclusion of data_object.php it is considering the path of the file in which user.class.php is included. I am facing such problems in more than one scenarios
I have to keep my directory structure the way it is but have to find a way to work with nested includes.
I used Document root of session it give root path as C:/wamp/www/ i appended the path for data_object.php include but this is not working. (note: the forward slash is present after www)
I am currently running on wamp server's localhost but after completion i have to host the solution on a domain. Pls help