CodeIgniter Forums
How to link to Ci modules - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: How to link to Ci modules (/showthread.php?tid=88669)



How to link to Ci modules - osebo - 10-15-2023

Hi, i did a fresh install of CI today and i am trying implement a moduler site but i am stuck.
I have created a Modules folder and inside the modules folder there are 4 modules
Admin = admin dashboard and everything admin
Auth = user registration/login and everything auth
Core = index page and everything site core
Users = users accounts, profiles and everything about the user.
So i want my core module to be the landing page. e.g if a user visites my site he will land on a page from core module.
This is what i have done.
i have list all my modules in app/config/autoload like so
'Modules\Core' => APPPATH . 'module/Core',
created a Views folder
created a Controllers folder
created Config folder
and all the corresponding folders but they are empty xcept the Controllers and the Views folders
i have copied the Home controller to Modules/Core/Controllers and changed the namespace to Modules\Core\Controllers and change the view to ('Modules/Core/Views/welcome_message')
I have edited app/config/routes to ('/', '\Modules\Core\Controllers\Home::index').
i am getting 404 sorry, cannot seem to find the your looking for.
Thanks in advance.


RE: How to link to Ci modules - JustJohnQ - 10-15-2023

Sorry, the given link is of course not relevant for modules...

Read:
https://codeigniter.com/user_guide/models/model.html#accessing-models


RE: How to link to Ci modules - kenjis - 10-15-2023

It seems you are doing good.
Check if there is no typos.

And see this repo as a reference.
https://github.com/kenjis/ci4-modules-test


RE: How to link to Ci modules - osebo - 10-16-2023

(10-15-2023, 09:34 AM)JustJohnQ Wrote: Sorry, the given link is of course not relevant for modules...

Read:
https://codeigniter.com/user_guide/models/model.html#accessing-models
Hi, thanks a lot, for your response, i have followed it very carefully but it's still not working.


RE: How to link to Ci modules - davis.lasis - 10-16-2023

1. Modules folder is `modules` or `Modules`?
2. Modules folder is located next to `app` folder or inside `app` folder?

app/Config/Autoload.php
if next lowercase:
PHP Code:
'Modules\Core' => ROOTPATH 'modules/Core'

if next uppercase
PHP Code:
'Modules\Core' => ROOTPATH 'Modules/Core'


if inside lowercase:
PHP Code:
'Modules\Core' => APPPATH 'modules/Core'
if inside uppercase
PHP Code:
'Modules\Core' => APPPATH 'Modules/Core'


Views:
PHP Code:
return view('Modules\Core\Views\home'); 



RE: How to link to Ci modulesSpelling Error fix - InsiteFX - 10-17-2023

Make sure that your Modules\Config\Routes.php file has the correct Namespace!