Code Modules |
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 =)
What error are you receiving?
Sounds like you need to set environment to development so you can see errors.
Here you have a back slash then a forward slash.
PHP Code: public $psr4 = ['Modules\Node' => ROOTPATH.'Modules/Node']; What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(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. (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');
I have my Admin module setup like this and it works fine.
PHP Code: // Autoload.php What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(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.
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. |
Welcome Guest, Not a member yet? Register Sign In |