![]() |
Module view file showing invalid - 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: Module view file showing invalid (/showthread.php?tid=79026) |
Module view file showing invalid - ciddict - 04-10-2021 I've added the module folder in ...\app\Config\Autoload.php Quote:public $psr4 = [ My directory: Quote:/Home directory of main project folder Routes.php PHP Code: namespace Config; Blog.php PHP Code: namespace Blog\Controllers; After running my_domain/index.php/blog, it's showing this error: Quote:CodeIgniter\View\Exceptions\ViewException Where I'm wrong? Looking for help. Thanks in advance. RE: Module view file showing invalid - davis.lasis - 04-10-2021 i have not replicated and tested, but by the looks you should change folders and paths names with capital letters to make exact path matches /example => /Example public $psr4 = [ APP_NAMESPACE => APPPATH, // For custom app namespace 'Config' => APPPATH . 'Config', 'Blog' => ROOTPATH . 'Example/Blog', ]; $routes->get('blog', 'Blog::index', ['namespace' => 'Blog\Controllers']); RE: Module view file showing invalid - paulbalandan - 04-10-2021 You do not have an `Example` namespace. It is actually `Blog`. So you should use that instead. PHP Code: function index() { RE: Module view file showing invalid - ciddict - 04-10-2021 @paulbalandan, it worked. Thank you so much. |