• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best way to extend namespaced modules

Hello there, 

I'm tinkering and discovering codeigniter 4, and now I face a scenario where I would like to ask which would be the best way to solve it. 

Let's say that I have a Blog controller in a separate namespace "Secondary/Blog/Controllers" with an Index method. This method just does a database query, sets a couple of vars and loads a view. 

What I want to achieve is a scenario where this controller serves as default, but sometimes I want to make changes to this controller without modifying the file so a new Blog controller will be made in the default App namespace. This new Blog extends the one in the secondary namespace and the route it's changed. 

How could use the index method and all their vars from the first controller into the second one? How could I serve views so they get printed only once? 


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.