Welcome Guest, Not a member yet? Register   Sign In
Loading wrong views in twiggy!
#2

(This post was last modified: 07-24-2015, 06:47 AM by mwhitney.)

fetch_module() simply returns the last module set in the router. Modules::run() calls the router's locate() method to find the controller and load it, which sets the router's module to the module of the newly-loaded controller, rather than the module initially used to handle the request.

The best work-around (other than avoiding Modules::run() or calling it at a point where the change of modules wouldn't cause an issue) would probably be to store the result of fetch_module() before calling Modules::run(), then set the router's $module property back to the previous value after calling Modules::run().

Edit: Another thought came to me... This might be similar to the issues Wiredesignz HMVC has with the form validation library. You may want to try a similar work-around with Twiggy, but extending the library to make $CI a public property, then setting the CI property to $this in your controller's constructor.
Reply


Messages In This Thread
Loading wrong views in twiggy! - by weblogics - 07-24-2015, 04:00 AM
RE: Loading wrong views in twiggy! - by mwhitney - 07-24-2015, 06:39 AM
RE: Loading wrong views in twiggy! - by weblogics - 07-24-2015, 08:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB