• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I use the normal URL variables structure with CodeIgniter?

I've been using CodeIgniter for a while, and I noticed that the way it passes the variables in the URL is not flexible at all, and requires extra coding at many parts of the program.

So, is there a way to have some sort of hybrid? something where I can pass variables like this:

If not, then can I just use the original method? if so, then how does it work within CodeIgniter?

Hi KeyStroke,
You can use the original query strings by enabling enable_query_strings option in application/config/config.php.
In addition take a look at:


[eluser]GSV Sleeper Service[/eluser]
you've got two options,

1. turn on query strings - http://ellislab.com/codeigniter/user-gui.../urls.html
2. pass those parameters as uri segments - http://ellislab.com/codeigniter/user-gui...s/uri.html

personally I'd go for the segments method.

Thanks guys. That will be pretty useful. Smile

[eluser]Andreas Krohn[/eluser]
If you want to pass things from a form via GET parameters into your app then you can use JavaScript to create the form action URL so it corresponds to the uri segments. Just make a javascript function that is called on the forms onSubmit and that sets location.href for the form, ie
onSubmit="location.href = getSearchFormLocation(); return false;"

In the function do something like:
if (form.myField.value != "") location = "/myFieldName/"+form.myField.value;

Works like a charm.

I'll use the segment method, better look for the url

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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