Unable to call controller in encoder

I have two applications in a Codeigniter project. The following is the structure:

/admin /index.php /application /admin /controllers /Dashboard /Product /Post /public /controllers /Home /About /Contact /system /index.php 

The public application may work fine. and I can call all controllers with this parameter:

 /*----seting in /index.php---*/ $application_folder = 'application/public'; /*----seting in /application/public/config/config.php---*/ $config['base_url'] = 'http://localhost/myweb/'; /*----seting in /application/admin/config/routes.php---*/ $route['default_controller'] = 'Home'; 

but the admin application cannot work fine. I can call the Dashboard Manager, which is the default controller that I installed. setup looks like this:

 /*----setting in /admin/index.php---*/ $application_folder = '../application/admin'; /*----seting in /application/admin/config/config.php---*/ $config['base_url'] = 'http://localhost/myweb/admin/'; /*----seting in /application/admin/config/routes.php---*/ $route['default_controller'] = 'Dashboard'; 

so when i am:

 http://localhost/myweb/ //it will return home page http://localhost/myweb/admin //it will return dashboard page http://localhost/myweb/admin/product //it will return error 

can anyone help me fix this case?

+5
source share
1 answer

Why not split the admin area in a subdirectory, rather than having two application directories. This way your public controllers and administrative controllers can share models, helpers, etc.

So this will be:

 /application /controllers /admin Index.php <-- admin controller inside 'admin' directory Index.php <-- public controller outside 'admin' directory /models /views /admin /public 
+1
source

Source: https://habr.com/ru/post/1270355/


All Articles