riwakawd 0 Light Poster

I have a helper function in codeigniter php where I can use helper like so load_controller('column_left', 'index'); for example "column_left" is the file and class name.

How ever that works fine but I would like to be able to type a folder name in load_controller('some_folder/some_class', 'index'); and it would detect controller.

Question How can I make it so if I type a name of a subfolder in controllers then will pick folder and filename up.

<?php

function load_controller($controller, $method = 'index', $params = '') {

    require_once (APPPATH . 'controllers/' . $controller . '.php'); // Need to sill have as backup

    $controller = new $controller();

    return $controller->$method($params);
}