Welcome Guest, Not a member yet? Register   Sign In
How to link to Ci modules
#1

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.
Reply
#2

(This post was last modified: 10-16-2023, 01:15 AM by JustJohnQ.)

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

Read:
https://codeigniter.com/user_guide/model...ing-models
Reply
#3

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
Reply
#4

(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/model...ing-models
Hi, thanks a lot, for your response, i have followed it very carefully but it's still not working.
Reply
#5

(This post was last modified: 10-16-2023, 07:14 AM by davis.lasis.)

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'); 
Reply
#6

(This post was last modified: 10-17-2023, 08:27 PM by InsiteFX.)

Make sure that your Modules\Config\Routes.php file has the correct Namespace!
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB