• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GET, bookmarkable searches, and forms

#1
[eluser]snifty[/eluser]
I'm sorry, I know this is discussed elsewhere in this forum (and also on Stackoverflow and various blog posts), but I have not been able to wrap my head around a solution for my particular situation. I'm going to describe what I'm trying to do and hope someone will take pity here and give me some pointers...

Example:

http://tangorin.com/general/

This is a Japanese dictionary site. If I type a word in the big input at the top, like "sushi" and press enter, I am sent to

http://tangorin.com/general/sushi

This seems to me to be an obvious thing to want to do -- for one thing, the link is bookmarkable. I'm also building a dictionary and bookmarkability is crucial. This sort of thing:


http://tangorin.com/general/14324DCAF3EDA

...won't cut it in this instance.

Now, surely this is possible, presumably through the use of routing, but I swear I can't figure out how to do that in CI. Any pointers would really be appreciated, thanks.

#2
[eluser]Seb[/eluser]
This is possible if you make use of URL rewriting (if you are using Apache, check the URL Rewriting guide on http://httpd.apache.org/docs/2.0/misc/rewriteguide.html).

Then you will be able to get search terms as function parameters in your controllers.

#3
[eluser]snifty[/eluser]
Thanks Seb.

I have .httaccess working. But I'm not sure I understand what role mod_rewrite would have in getting such a URL to work. CI has a routing module, aren't I going to have to use that in the end anyway?

#4
[eluser]Seb[/eluser]
Well you can use both, but I'd rather be using URL rewriting with .htaccess because I guess it is more secure and less CPU-intensive than CI re-routing.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.