• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using GET and trying to get function arguments set

This page:

tells me how to setup the CI so I can use the keywords c and m to pull the controller and function, however, when I set the third parameter to the function's argument name (statename in my case), the function ignores this. The example in the docs has:


So, I'm assuming there is a way to use the id=345 part, it would be logical if that was the function's argument, meaning, I would expect the products controller to have a function that starts with:

function view($id) {

And the id from the URL string would be put in the $id of the view. In our case, this isn't happening, so, how do we make this happen?

The extra get arguments are not passed to the function... you can recover them by the superglobal $_GET array or throught $this->input->get('id')

Wow - that is going to be a pain - we have a lot of controllers and we need to be able to catch google/MSN/Yahoo URL string passed keyword searches and we also need the landing pages to be able to be state specific (the joys of SEO and pay per click tracking)

Thanks for the info, may have to crack open the application code and make it work easier for us.

The main issue is that you shouldn't be able to know the function parameters name.. so you won't knwo if the first argument should be $_GET['id'] or something else...
May be if you are using PHP 5 you can use reflection

make sure "enable_query_strings" is set to TRUE in the config.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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