CodeIgniter Forums
create modules in CI 4.3.1 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: create modules in CI 4.3.1 (/showthread.php?tid=86181)



create modules in CI 4.3.1 - lindaw - 01-18-2023

Hello ,
First thank you to all for this nice working CI framework, really nice.
I have downloaded , installed and working just fine, but I lost on the documentation process of CI , I followed all step but no luck.
i searched , not enough step by step except this post here (https://swww.com.pl/main/index/building-a-module-for-codeigniter-4) worked but still not complete
there is no way to show the view from module view folder.

modules/
    User/
        Config/
        Controllers/  here is my Controller php file pointing to views under acme
        Libraries/
        Models/
        Views/  here is my view php file

when I type my url with user/login,
this part not working, CI doesn't see modules/User/Views/login.php
Code:
public function login(){
      $data = [];
      return  view('Modules\User\Views\login',$data);
    }

but this works

Code:
public function login(){
  
      return  view('welcome_message.php');
    }

Looks CI point to main views folder and not new created views in modules/User folder
any idea how to fix this issue please?

Thank you


RE: create modules in CI 4.3.1 - kenjis - 01-18-2023

view('Modules\User\Views\login',$data) should work
https://codeigniter.com/user_guide/general/modules.html#views

if you set the namespace correctly:
https://codeigniter.com/user_guide/general/modules.html#namespaces


RE: create modules in CI 4.3.1 - lindaw - 01-19-2023

(01-18-2023, 06:25 PM)kenjis Wrote: view('Modules\User\Views\login',$data) should work
https://codeigniter.com/user_guide/general/modules.html#views

if you set the namespace correctly:
https://codeigniter.com/user_guide/general/modules.html#namespaces

thank you that worked