[eluser]InsiteFX[/eluser]
Now try urlencode
InsiteFX
[eluser]micflan[/eluser]
CodeIgniter's URL helper also has a function that would work.
Code:
url_title('Dumb / Dumber');
[eluser]wh1tel1te[/eluser]
You could base64_encode it, then base64_decode it at the other end:
Code:
echo site_url('controller/method/' . base64_encode($var));
Code:
function method($var)
{
$var = base64_decode($var);
}
[eluser]InsiteFX[/eluser]
You could also try adding it here, but not recommended!
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'/;
InsiteFX
[eluser]searain[/eluser]
thanks i replace / with - before passing the parameter, and replace it back
but url_title seems to be a more universal solution. I will check this out.
[eluser]searain[/eluser]
base64_encode is the approach i was looking for. Thanks for all your help.
base64_encode has / = which are not valid url characters in CI.
So I could use the str_replace, say replace / with _ replace = with -. and then replace them back and base64_decode it.
Is this the right way to pass the parameter value in url in CI? It has been a trouble for CI that sometimes we need pass values in url and these values have the invalid characters. And I don't want to loose the universal set up for the valid uri characters.
Of course, this way, we get around the uri character validation checking, so we need be extra careful, validation checking these values.
[eluser]gcman105[/eluser]
I have a similar problem.
I'm writing an application that uses pre existing product data eg: BA/RL
I have setup a controller with a view function that takes the 3rd segment as the product ID, works fine for product ID's without the / in eg: ANT
Whats the best way to hadle this?
[eluser]searain[/eluser]
"encode" the value before pass
$value = str_replace('=', '-', str_replace('/', '_', base64_encode($value)));
"decode" the value after receive
$value = base64_decode(str_replace('-', '=', str_replace('_', '/', $value)));
You can write a helper like this.
I don't do this on the values input by the end users.
And after receive the value, I validate the value again.
[eluser]gcman105[/eluser]
Thanks.