Is it possible to have subforder in Controlllers directory - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: Is it possible to have subforder in Controlllers directory (/showthread.php?tid=76004) |
Is it possible to have subforder in Controlllers directory - kris2 - 04-06-2020 I am starting a project and wanted to put all admin controler in a sub directory admin. I try it but I receveive a message the Controller or its method is not found: App\Controllers\Admin::categ I don't want to put all sources in only the same controller directory RE: Is it possible to have subforder in Controlllers directory - jreklund - 04-06-2020 You need to reference it as App\Controllers\Admin\Admin, as it's an Admin controller inside an Admin folder. PHP Code: namespace App\Controllers\Admin; RE: Is it possible to have subforder in Controlllers directory - kris2 - 04-08-2020 (04-06-2020, 08:57 AM)jreklund Wrote: You need to reference it as App\Controllers\Admin\Admin, as it's an Admin controller inside an Admin folder. Thank you. I think something is still missing Class 'App\Controllers\Admin\BaseController' not found APPPATH/Controllers/Admin/Acticateg.php at line 2 Code: 1 <?php namespace App\Controllers\Admin; RE: Is it possible to have subforder in Controlllers directory - jreklund - 04-08-2020 BaseController are in the \App\Controllers\BaseController and needs to have it's full reference or you need to specify use. PHP Code: <?php namespace App\Controllers\Admin; PHP Code: <?php namespace App\Controllers\Admin; RE: Is it possible to have subforder in Controlllers directory - kilishan - 04-08-2020 I've got a couple of free articles about namespaces that will help clarify things for you, I think: Primar: Namespaces and CI4 Going Deeper with Namespaces RE: Is it possible to have subforder in Controlllers directory - kris2 - 04-09-2020 Thank you that works now. |