code igniter Modular Extensions - Access level to MX_Router::_set_default_controller() must be public (as in class CI_Router) code igniter Modular Extensions - Access level to MX_Router::_set_default_controller() must be public (as in class CI_Router) codeigniter codeigniter

code igniter Modular Extensions - Access level to MX_Router::_set_default_controller() must be public (as in class CI_Router)


Solution 1

I had to change several methods visibility in Router.php , so I changed the following methods from protected to public to get it fixed

_set_default_controller()_set_request()_set_default_controller()

and it almost worked but now i get a warning above the familiar Welcome to CodeIgniter message

Message: Undefined property: MY_Router::$translate_uri_dashes

so I wrapped this property around an if not empty to bypass this property like so

if(!empty($this->translate_uri_dashes))        {            if ($this->translate_uri_dashes === TRUE)            {                foreach(range(0, 2) as $v)                {                    isset($segments[$v]) && $segments[$v] = str_replace('-', '_', $segments[$v]);                }            }        }

and now it works!


Solution 2

there is a ready HMVC-ci that can be downloaded from

http://lab.clearpixel.com.au/2011/10/modularise-your-codeigniter-2-applications-with-modular-extensions-%E2%80%93-hmvc/

but it's a ci 2.0.3 version not ci 2.2.2

Solution 3 (best)

if you place the core files (MY_Loader and MY_Router) and the third-party folder (MX) from the preconfigured version of ci 2.0.3 (link above) inside the corresponding locations in the ci 2.2.2 it will work just fine.