KeepLearning 0 Posted March 18, 2013 Report Share Posted March 18, 2013 Version 0.5 Page 150 Larry, Can you please break this paragraph down or explain it another way? I've read it and re-read it numerous times. I understand the preceding and following pages, but not this paragraph and example. Thanks. "However, when you’ve identified a parameter in a rule that’s not part of the route, it will only be passed to an action if that action’s parameter is named the same. The earlier example code works, but this action definition with that same rule will throw an exception (Figure 7.1): # protected/controllers/PageController.php public function actionView($x) { // Etc." Quote Link to post Share on other sites
Larry 428 Posted March 18, 2013 Report Share Posted March 18, 2013 If you have a parameter in a routing rule, the action method's parameter has to use the same name. For example, the rule before this code, I believe, uses "id" as the parameter (for the page ID). So the actionView() method has to use $id for its parameter: public function actionView($id) { Using $x in the method definition, when the routing rule uses "id", throws an exception. 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.