How to run another controller folder in hmvc codeigniter 4 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: How to run another controller folder in hmvc codeigniter 4 (/showthread.php?tid=81590) |
How to run another controller folder in hmvc codeigniter 4 - startup - 03-21-2022 Modules Site/Home/Controllers/HomeController.php Modules Site/Student/Controllers/StudentController.php i configure in autoload below PHP Code: public $psr4 = [ PHP Code: $routes->setDefaultNamespace('Modules\Site\Home\Controllers'); if i move student controller to folder home controller, it working please show me how to fix it thank you RE: How to run another controller folder in hmvc codeigniter 4 - iRedds - 03-21-2022 1. Such a namespace entry is meaningless. PHP Code: 'Modules\Site\Home' => ROOTPATH. 'Modules/Site/Home', // here we have added. Use PHP Code: 'Modules' => ROOTPATH. 'Modules', 2. This only works for one reason. The namespace in the StudentController class is specified as Modules\Site\Home\Controllers instead of Modules\Site\Student\Controllers PHP Code: <?php 3 The default namespace is Modules\Site\Home\Controllers. Therefore, for the StudentController controller, you need to specify the appropriate namespace. PHP Code: $routes->get('([a-z0-9-]+)\.html$', '\Modules\Site\Student\Controllers\StudentController::proByCate/$1'); RE: How to run another controller folder in hmvc codeigniter 4 - startup - 03-21-2022 (03-21-2022, 10:34 PM)iRedds Wrote: 1. Such a namespace entry is meaningless. |