Welcome Guest, Not a member yet? Register   Sign In
how to implement dynamic "routes"?
#21

[eluser]narkaT[/eluser]
extending the Router-class sounds interesting.

My current approach just overwrites the _validate_request-method and
later calls the orginal method.

pretty simple:
Code:
class MY_Router extends CI_Router {

    function MY_Router() {
        parent::CI_Router();
    }

    function _validate_request($segments) {
        // Does the requested controller NOT exist in the root folder? I won't use subfolders, till now
        if ( !file_exists(APPPATH.'controllers/'.$segments[0].EXT) ) {
            $segments = array('alias', implode('/', $segments));
        }
        return parent::_validate_request($segments);
    }
}

any further suggestions?
Otherwise I would stick to that solution Smile

Greetings
Jan




Theme © iAndrew 2016 - Forum software by © MyBB