Andrew Willis
Andrew Willis

Reputation: 2349

Kohana 3.2 - How do you send variables whith your routing?

I have the following route set at the end of the route list for my site which allows a final check on the uri value to provide my site users with a vanity URL (http://example.com/username)

Route::set('profile', '<path>/(<page>)', 
    array(
        "path" => "[a-zA-Z0-9_-]+",
        "page" => (blog|photos)))
->defaults(array(
    'controller' => 'welcome',
    'action'     => 'profile'
));

This route directs properly to the welcome controller and the profile method, however I was wondering if there was a way to get the path and page values sent to the method like so:

action_profile($var1, $var2) {
    echo $var1 . ' ' . $var2;
}

I don't want to rely on $this->request->uri() and exploding the result into an array unless there is absolutely no other way of doing this.

Upvotes: 0

Views: 423

Answers (1)

biakaveron
biakaveron

Reputation: 5483

Read the manuals please: http://kohanaframework.org/3.0/guide/kohana/routing#request-parameters. $this->request->param('param-name') will helps.

Upvotes: 1

Related Questions