Welcome Guest, Not a member yet? Register   Sign In
CI4 Question (Module Calling Module)
#1

Hi Everyone,

Can you tell me how to call a module within a module.
Reply
#2

The best exmple is math auth and learn how to implement ed in ci4

https://github.com/lonnieezell/myth-auth
Enlightenment  Is  Freedom
Reply
#3

(06-30-2021, 10:14 PM)[email protected] Wrote: Hi Everyone,

Can you tell me how to call a module within a module.

what are you trying to do?
Reply
#4

(07-01-2021, 03:04 AM)ikesela Wrote:
(06-30-2021, 10:14 PM)[email protected] Wrote: Hi Everyone,

Can you tell me how to call a module within a module.

what are you trying to do?

Hi, I am using HMVC in Codeigniter 4 functionality and I want to call a module in the another module.

Like, IN CI3 we use below line,
Modules::run('dashboard/index', $data); So, How we can use this in CI4
Reply
#5

Create a route to it using the modules namespace see the CodeIgniter User Guide URI Routing.

Ig you need link it in html then look in the url helper for route_to()
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

(07-01-2021, 09:18 PM)InsiteFX Wrote: Create a route to it using the modules namespace see the CodeIgniter User Guide URI Routing.

Ig you need link it in html then look in the url helper for route_to()


 Modules::run() This function is not working in CI4. So, can you please tell me what is the solution for that?
Reply
#7

PHP Code:
$module = new \Namespace\ModuleName(); 

Add your own module static method called run(). then you can call 
PHP Code:
$module::run(); 

You will need to setup your run method for any parameters to pass.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#8
Thumbs Up 

(07-04-2021, 02:42 AM)InsiteFX Wrote:
PHP Code:
$module = new \Namespace\ModuleName(); 

Add your own module static method called run(). then you can call 
PHP Code:
$module::run(); 

You will need to setup your run method for any parameters to pass.

Thank you
Reply




Theme © iAndrew 2016 - Forum software by © MyBB