Welcome Guest, Not a member yet? Register   Sign In
CI_Config BUG
#1

[eluser]paulipv[/eluser]

Bug description:

When query strings are enabled, but they are not present in the URL site_url will append '?'
and uri routing will not work.

My sollution to fix that.

1. Extends the CI_Config

Code:
<?php

  

   class MY_Config extends CI_Config {

             function __construct()
             {
parent::__construct();
             }

             function site_url($uri = '')
             {

$sign = '';

if ($uri == '')
{
           return $this->slash_item('base_url') . $this->item('index_page');
}

if ($this->item('enable_query_strings') == FALSE)
{
           $suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
           return $this->slash_item('base_url') . $this->slash_item('index_page') . $this->_uri_string($uri) . $suffix;
}
else
{
           if (isset($_GET[$this->item('controller_trigger')]))
           {
                     $sign = '?';
           }
           return $this->slash_item('base_url') . $this->item('index_page') . $sign . $this->_uri_string($uri);
}
             }

   }




Theme © iAndrew 2016 - Forum software by © MyBB