Welcome Guest, Not a member yet? Register   Sign In
Can't call the right action
#2

[eluser]Mirage[/eluser]
Given your URL example the url parameter would be passed to the index function, not the constructor. So

Code:
public function __construct() {
....
}

public function index($idMail) {
      echo $idMail;
}

That said, if you like receiving uri segments in your controller actions, I'd always make them optional to avoid nasty error. Imagine someone would type the url with out the message id segment. Your index would be called, but you'd get the same errors you just described. If you check parameter availability in the action, you can more graceful exit on error. So

Code:
public function index ($idMail=null) {
    if (is_null($idMail) {
        show_404()
    }

    echo $idMail;

}

Cheers,
-m


Messages In This Thread
Can't call the right action - by El Forum - 10-11-2008, 11:48 AM
Can't call the right action - by El Forum - 10-11-2008, 12:01 PM
Can't call the right action - by El Forum - 10-11-2008, 01:12 PM
Can't call the right action - by El Forum - 10-11-2008, 01:55 PM
Can't call the right action - by El Forum - 10-11-2008, 02:11 PM
Can't call the right action - by El Forum - 10-11-2008, 02:43 PM
Can't call the right action - by El Forum - 10-11-2008, 02:56 PM
Can't call the right action - by El Forum - 10-11-2008, 03:09 PM
Can't call the right action - by El Forum - 10-11-2008, 03:14 PM
Can't call the right action - by El Forum - 10-11-2008, 03:47 PM
Can't call the right action - by El Forum - 10-11-2008, 04:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB