views:

119

answers:

3

hi all,

i'm developing cakephp application.

i need some specific characters in url, like & (ampersand), because i need it for search purpose.

but, if i have ampersand in my url (like http://localhost/myapp/publications/index/string:Mono%20Manana/tags:publisher), it is rewrited and redirected as default url (in this case http://localhost/myapp/).

can you help me how to solve this and to use all kind of strings in my application.

thank you in advance!

A: 

Did you use urlencode()?

Some of your source code would really help us to see what's going on.

Leo
not yet. where it should be placed?
We can't answer that precisely without any code, but you should wrap your values with `urlencode()`. Using your example URI above, `urlencode( 'Mono Manana' )` and `urlencode( 'publisher' )` would be appropriate.
Rob Wilkerson
sibidiba
Now you need to post some code so that we can get some idea of what is happening.
Leo
A: 

ok, just to mention that i did find solution, not with urlencode, but using base64_encode. hopefully it will do the job...

A: 

How did you solve this? I've exact the same problem and can't figure it out (both urlencode en base64_encode tried)

foreach($brands as $brand) {
        echo $this->Html->link(ucwords($brand), array('action' => 'index', 'brand' => urlencode(low($brand))));

        echo '<br />';
    }

Purpose is to give an overview of links of all the brands and by clicking on one you can see products of a specific brand. But some of the brand names have an ampersand in them. For instance the brand 'D&G'. If I click on that link I get redirected to /products/index/brand:d&g. A visit to that link redirects me to just /products/index. Not what I want in fact.

Laurent