Welcome Guest, Not a member yet? Register   Sign In
Best way to extend namespaced modules
#1

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? 

Thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB