Welcome Guest, Not a member yet? Register   Sign In
URL parameters: Why difficult / impossible with CI?
#1

[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
#2

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

[eluser]Matthew Pennell[/eluser]
http://ellislab.com/codeigniter/user-gui.../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




Theme © iAndrew 2016 - Forum software by © MyBB