Welcome Guest, Not a member yet? Register   Sign In
Routes: how to get mycontroller/id function same as mycontroller/action/id
#4

[eluser]marcoss[/eluser]
[quote author="dreamynsx" date="1192829171"]
Code:
// my sample class with index action
class MyController extends Controller
{
    function index($id="")
    {
        // do fun things here
    }

    function add() {
       // do more fun things here
    }

}
[/quote]

You should rewrite that like this,

Code:
class MyController extends Controller
{
    function index()
    {
        // load home
    }

    function id($id=0) {
       // get record by $id
    }

}

Then you get http://site.com/cars/id/3.


Messages In This Thread
Routes: how to get mycontroller/id function same as mycontroller/action/id - by El Forum - 10-19-2007, 01:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB