![]() |
Code Modules - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Code Modules (/showthread.php?tid=73916) |
Code Modules - Nome - 06-24-2019 Earlier, I already wrote about problems with module code. And again, I experienced deja vu, what was before now does not work. I get an error at page request ex.com/node Quote:We seem to have hit a snag. Please try again later...ex.com\app\Config\Autoload.php PHP Code: class Autoload extends \CodeIgniter\Config\AutoloadConfig PHP Code: <?php namespace Modules\Node\Controllers; PHP Code: $routes->setDefaultNamespace('App\Controllers'); I apologize for the code but it is very short to upload it somewhere else, and thanks for your tolerance =) RE: Code Modules - kilishan - 06-24-2019 What error are you receiving? Sounds like you need to set environment to development so you can see errors. RE: Code Modules - InsiteFX - 06-24-2019 Here you have a back slash then a forward slash. PHP Code: public $psr4 = ['Modules\Node' => ROOTPATH.'Modules/Node']; RE: Code Modules - mladoux - 06-24-2019 (06-24-2019, 02:33 PM)InsiteFX Wrote: Here you have a back slash then a forward slash. The '\' referencing a namespace, and the '/' is referencing a file path, so this is correct. I don't know if it's correct other than the context of namespaces and file paths as far as the rest of the script is concerned. RE: Code Modules - Nome - 06-25-2019 (06-24-2019, 08:54 AM)kilishan Wrote: What error are you receiving? Controller or its method is not found: \Modules\Node\Controllers\Node::index but in my: ex.com\modules\Node\Config\Routes.php PHP Code: $routes->group('node', ['namespace' => 'Modules\Node\Controllers'], function($routes) ex.com\app\Config\Routes.php PHP Code: $routes->add('node', 'Modules\Node\Controllers\Node::index'); RE: Code Modules - InsiteFX - 06-25-2019 I have my Admin module setup like this and it works fine. PHP Code: // Autoload.php RE: Code Modules - Nome - 06-25-2019 (06-25-2019, 04:33 AM)InsiteFX Wrote: I have my Admin module setup like this and it works fine. You Routes.php in app/Config or Admin/Config ? P.S I changed backslash than a forward slash but it did not help me. RE: Code Modules - InsiteFX - 06-25-2019 app config or in my module it works both ways for me. RE: Code Modules - Nome - 06-27-2019 So i understanding... 1. ex.com\app\Config\Autoload.php (in __construct) write any namespaces... (Don't change name of the 'CodeIgniter') PHP Code: $psr4 = ['Any' => ROOTPATH.'Anymodules']; PHP Code: $routes->get('any', 'Anymodules\Any\Controllers\Any::index'); PHP Code: <?php namespace Anymodules\Any\Controllers; It works ! Sorry to bother you, everything turned out to be easy. I hope this will help others in the future. |