CodeIgniter Forums
CI4 - Module not working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: CI4 - Module not working (/thread-75725.html)



CI4 - Module not working - tmtuan - 03-10-2020

Hi,

I try to create new module, i follow this https://codeigniter4.github.io/userguide/general/modules.html

My module structure is

[Image: ci4.png]

but when i try to access my module with the url: http://devpj.local/blog 
i got the error message 404 - File Not Found
can anyone help me


RE: CI4 - Module not working - tmtuan - 03-12-2020

I got the problem. The CI doesn't scan my Routes.php in acp/blog/config
when i move my Routes code from that folder to app/config/routes.php it work fine

Can anyone help me, how can i make the fw auto load my Routes.php in acp/blog/config???


RE: CI4 - Module not working - aybarsm - 03-13-2020

Hey there,

According to your path, could you please try putting both $psr4 array in Autoload.php
Code:
'Acp'      => ROOTPATH . 'acp',
'Acp\Blog'      => ROOTPATH . 'acp/Blog',



RE: CI4 - Module not working - InsiteFX - 03-13-2020

I posted this in the other forum topic but I will also paste it here.

PHP Code:
namespace acp/Blog

$psr4 
= [
    'App'         => APPPATH,                     // To ensure filters, etc still found,
    APP_NAMESPACE => APPPATH,                     // For custom namespace
    'Config'      => APPPATH 'Config',          // Config namespace
    'acp\Blog'    => ROOTPATH.'acp\Blog',         // Acp Blog module
]; 

You need to setup your Config/Autoload.