I find it difficult to make a single configuration file (responsible for the
__autoload ) to be used by both the files that are in the root and those that are in the
The root directory contains the
admin folders. The
app folder contains the configuration file and the model , view and controller directories.
In the admin folder I want to keep a similar structure, with an app folder, containing the controller and view directory.
The intention is to make the files inside
admin/app/controller access the classes through the configuration file contained in
raiz/app and this is the only file responsible for including the classes. For this, I used the inclusion of the folders root ,
set_include_path() (I use XAMPP).
Well, if the file that calls the class is in root , or in
raiz/app/controller , the class is instantiated, but nothing works in
raiz/admin , or
For you to understand how I was doing, I had a configuration file for each folder, as well as an app , equipped with controller , model and view for each application (awful for maintenance) and it worked.
The problem was solved by adding constants in the initialization file, containing the path not only to the directory with classes, but also to controllers and views.
<?php // um monte de instruções define('APP_DIR', $_SERVER['DOCUMENT_ROOT'] . '/app/'); define('HOST_MODEL', APP_DIR . 'model/'); ?>
Hope it helps someone.