Welcome Guest, Not a member yet? Register   Sign In
cannot overwrite URI method _detect_uri
#1

[eluser]redwiz[/eluser]
My situation is a bit complicated, i'll try to explain.
I use CI with query strings disabled, with the default URI system based on segments.

Unfortunately sometimes i'm forced to accept query strings in my URL's becuase google adwords manual tagging campaigns need that:

http://support.google.com/adwords/certif...wer=156114

The solution to my problem is to tell apache rewrite th e url ignoring every query string (question mark at the end of the rule):

RewriteCond $1 !^(index\.php|assets|media|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1? [L]

The system works well almost everywhere, except if i have an URL without segments with a query string:

http://site.com/?string

in this case URI class take the query string as the first segment of URI, this happen becuase insisde function _detect_uri:
Quote:// This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct
// URI is found, and also fixes the QUERY_STRING server var and $_GET array.

Ok, i had to deal with that, no problem, i just have to extend URI and rewrite tyhat function.
But i couldn't because _detect_uri is declared as private and cannot be extended unless a change directly inside the system core URI class, that is something i prefer avoid, to keep my code portable between CI installation (and hopefully versions).

So the question is, what's the point to have private functions inside CI libraries?
Why do not let the developer make all the changes he wants?
And, at last, why don't you declare all non public functions as protected instead private?


thanks a lot

Andrea Consigli




Theme © iAndrew 2016 - Forum software by © MyBB