CodeIgniter Forums
URL parameters: Why difficult / impossible with CI? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: URL parameters: Why difficult / impossible with CI? (/showthread.php?tid=3722)



URL parameters: Why difficult / impossible with CI? - El Forum - 10-18-2007

[eluser]Unknown[/eluser]
I'm writing an application that must take in a few parameters from the URL. That means I must accept them as traditional name/value pairs. Example:

myfile.php?name=jon&color=blue

The end user may want to pass me a few more name/value pairs too.. but the other ones are optional.. for example:

myfile.php?name=jon&color=blue&age=55&state=CA

It seems like code igniter requires me to use slash notation. What's the correct way for me to pass this stuff with CI's slash notation so that the variables are accessable by their names. For example:

$_GET["state"]

Thank you!
Jon


URL parameters: Why difficult / impossible with CI? - El Forum - 10-18-2007

[eluser]sophistry[/eluser]
look at CI manual for information on routing and uri class.


URL parameters: Why difficult / impossible with CI? - El Forum - 10-19-2007

[eluser]Matthew Pennell[/eluser]
http://ellislab.com/codeigniter/user-guide/general/urls.html

Quote:In some cases you might prefer to use query strings URLs:

Code:
index.php?c=products&m=view&id=345

CodeIgniter optionally supports this capability, which can be enabled in your application/config.php file. If you open your config file you'll see these items:

Code:
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

If you change "enable_query_strings" to TRUE this feature will become active. Your controllers and functions will then be accessible using the "trigger" words you've set to invoke your controllers and methods:

Code:
index.php?c=controller&m=method