Input.route
Input.route($paramName, $ruleset = 'id') -> any
Description
Get the value of a URL route parameter.
Routes are defined in config/app.jcon
. (See Route Params)
NoteOnly these characters are allowed in a route param:
a-z 0-9 . -
// config/app.jcon //----------------------------------- routes: { /post/{postTitle}: post.tht } // code/pages/post.tht //----------------------------------- // URL: /post/book-review Input.route('postTitle') //= 'book-review'
Validation
It will be validated per the given $ruleset
. (See Input Validation)
If it does not pass validation, a default value will be returned for its type.
// Route: /user/{userId} // URL: /user/314 Input.route('userId', 'i') //= 314 // URL: /user/abcd Input.route('userId', 'i') //= '' (invalid)