Welcome Guest, Not a member yet? Register   Sign In
Using GET and trying to get function arguments set
#1

[eluser]kaosweaver[/eluser]
This page:
http://ellislab.com/codeigniter/user-gui.../urls.html

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:

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

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:

Code:
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?
#2

[eluser]Seppo[/eluser]
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')
#3

[eluser]kaosweaver[/eluser]
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.
#4

[eluser]Seppo[/eluser]
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
#5

[eluser]Pygon[/eluser]
make sure "enable_query_strings" is set to TRUE in the config.




Theme © iAndrew 2016 - Forum software by © MyBB