CodeIgniter Forums

Full Version: Changing letters in search function (url and function)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]peekk[/eluser]
Hello I have the following problem, my site is non-english language based.
I have search function in my controller which is like
Code:
public function search($keyword, $offset, ...){}

When people type search query to searchbox on my site, it turns them into mysite.com/search/query.

Thing that bothers me is, that there are non-english characters in my keywords. I have another function, which converts them to english chars, but I want this new string also appears in my URL - it will be more seo-friendly.

So, when people type search queries into my searchbox, they are typing in non-english, it goes into URL in no-english, so is: mysite.com/search/non-english. It's wrong, i want it to be mysite.com/search/converted, but it must search for exact query typed in box (non-english).

Any ideas? Smile

El Forum

[eluser]Aken[/eluser]
In the controller that processes the POST request:

1) Validate the orignal search query. Once it is valid...
2) Add it to session userdata.
3) Figure out what the English version is.
4) Forward the user to mysite.com/search/englishversion
5) On the results page, check if the session variable exists. if it does, search by that. If not, search by what's in the URL (make sure to sanitize it).