Welcome Guest, Not a member yet? Register   Sign In
URI changes . to _ (best practice?)
#1

[eluser]escape[/eluser]
Hello,

As posted numerious times in this forum, users encounter situations where CI changes certain characters in a URI to underscores. And in most cases this can be resolved by changing the URI protocol to "REQUEST_URI" or whatever seems to work on your server.

Although I have used this method in the past with success, I'm concerned that changing the URI protocol will introduce unexpected results in other parts of the application.

For example, I have a CI controller which accepts a URI containing decimal numbers. The numbers are passed into a function via the argument list like:

Code:
function crunch_number($decimal)
{
echo $decimal;
}

INPUT: www.mydomain.com/mycontroller/crunch_number/5.369
OUTPUT: 5_369

Where, CI converts the decimal numbers to strings with an underscore

If I do not want to change the URI protocol I simply do this:

Code:
function crunch_number($decimal)
{
echo str_replace('_', '.', $decimal);
}

INPUT: www.mydomain.com/mycontroller/crunch_number/5.369
OUTPUT: 5.369

And life is good.

The point of my post is, can a developer experience unexpected concequences when they change the URI Protocol to fix one thing then discover that change affects something else in the program?

Thanks,
Chris


Messages In This Thread
URI changes . to _ (best practice?) - by El Forum - 08-23-2010, 08:32 AM
URI changes . to _ (best practice?) - by El Forum - 08-23-2010, 09:56 AM
URI changes . to _ (best practice?) - by El Forum - 08-23-2010, 10:41 AM
URI changes . to _ (best practice?) - by El Forum - 08-23-2010, 11:20 AM
URI changes . to _ (best practice?) - by El Forum - 08-23-2010, 07:52 PM
URI changes . to _ (best practice?) - by El Forum - 01-18-2011, 01:38 PM
URI changes . to _ (best practice?) - by El Forum - 01-18-2011, 04:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB