CodeIgniter Forums

Full Version: Class and Function URI segments redundant - how to work around them?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

There are plenty of occasions when I don't actually need to specify my class and function, but I am forced to. Is there a way to get straight into the "id" part, i.e. the part that is passed as a parameter?

For instance, I want a welcome controller that does nothing more than output something from the URI. I want to go to<foo> and see <foo> on the page - that's it.

Without CI this is ridiculously easy. The index.php file just echoes what's in the $_GET. A .htaccess file, as with CI, reduces back to Easy. But how to do this with CI?

A similar case. A function in my welcome controller accepts a parameter. Why must I go to rather than just, when the "welcome" has been implicit all along? This is basically the same question as before: why do I have to specify rather than just when the "welcome" and "index" were previously implicit?

Note that I only want this to happen on particular pages, which is again very easy without CI. My "foods" page may have no further functions, and hence just immediately accept a parameter. I can use, or to do this. But in CI, the foods/param is assumed to refer to a function "param" in the "foods" class. How do I specify, only on the "foods" page, that the second URI segment is to be passed as a parameter?

Is there a way to work around this? Thanks for any help.

El Forum

[eluser]Michael Wales[/eluser]
URI Routing