CodeIgniter Forums
query strings enabled and controllers into sub-directories - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: query strings enabled and controllers into sub-directories (/thread-6596.html)



query strings enabled and controllers into sub-directories - El Forum - 03-05-2008

[eluser]Unknown[/eluser]
Hi,

When query strings are enabled, whe can set
Code:
$config['directory_trigger'] = 'd';
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

That allow us to specify directory of a controller, controller we call and method of the controller.

But the directory_trigger were not used, so query-strings were not available for those who used sub-directory to organize controllers.

To solve the problem, I've just added some line in Router.php, function _set_routing()
Code:
//Router.php, function router->_set_routing()
    function _set_routing()
    {        
        // Are query strings enabled in the config file?
        // If so, we're done since segment based URIs are not used with query strings.
        if ($this->config->item('enable_query_strings') === TRUE AND isset($_GET[$this->config->item('controller_trigger')]))
        {
            $this->set_class(trim($this->uri->_filter_uri($_GET[$this->config->item('controller_trigger')])));

            //The 3 following lines were missing in the original script
            if (isset($_GET[$this->config->item('directory_trigger')]))
            {
                $this->set_directory(trim($this->uri->_filter_uri($_GET[$this->config->item('directory_trigger')])));
            }
            
            if (isset($_GET[$this->config->item('function_trigger')]))
            {
                $this->set_method(trim($this->uri->_filter_uri($_GET[$this->config->item('function_trigger')])));
            }
            
            return;
        }

        //Here some more code

Note : I've just updated my local CI scripts, nothing else. So, if somewhone could fix it, it would be fine Wink