Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7054017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:34:30+00:00 2026-05-28T03:34:30+00:00

Route::set(‘category’, ‘category/date/<id>(/<year>)’, array(‘id’ => ‘[0-9]+’, ‘year’ => ‘[0-9]+’)) ->defaults(array( ‘controller’ => ‘category’, ‘action’ =>

  • 0
Route::set('category', 'category/date/<id>(/<year>)', array('id' => '[0-9]+', 'year' => '[0-9]+'))
->defaults(array(
        'controller' => 'category',
        'action' => 'date',
    ));

Is there any cap for parameters on a kohana 3.2 route?

I’ve implemented this route in my bootstrap but everytime I try to pass the year value I get a 404 error!

Passing of the ID alone just works fine.

Am i missing anything?

This is the controller action for handling this route:

public function action_date() {
    $id = $this->request->param('id');
    $year = $this->request->param('year');
    if(!isset($year) && $year == ""){
        $year = date("Y", time());
    }
    //Do fancy stuff here... and hand it to the view!
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:34:31+00:00Added an answer on May 28, 2026 at 3:34 am

    Kohana should route that to the right action, and it does for me. My guess is that you either overwrite that route with one also named ‘category’ or it gets matched by another route which action throws a Kohana_Exception_404.

    You should be able to dissmiss/verify if a Kohana_Exception_404 is thrown from a method by looking at the stack trace.

    Route names are used as key names for the array in which the routes are stored as can be seen below. Using the same name twice would overwrite the previous route which was under that name.

    public static function set($name, $uri_callback = NULL, $regex = NULL)
    {
        return Route::$_routes[$name] = new Route($uri_callback, $regex);
    }
    

    You could use the following in a action somewhere to see all the routes used for routing: $this->response->body(Debug::vars(Route::all()));
    Then you are able to check the compiled regex of the ‘category’ route or similar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My routing is set up like this: Route::set('default', '(<controller>(/<action>(/<id>)))') ->defaults(array( 'controller' => 'static', 'action'
Consider this route in bootstrap.php ... Route::set('crud', 'staff/<controller>(/<action>(/<id>))', array( 'controller' => '(activities|users|default-emails)', 'action' =>
I have this routing defined in my module's init.php; Route::set('store', 'store/<store_id>(/<controller>(/<action>(/<id>)))', array( 'store_id' =>
I have a route: Route::set('foo/subdir', '<directory>/<variable>/subdir/<controller>/<action>'); I would like to route this url to
I have the following route in my bootstrap: Route::set('cycleadmin', '(<lang>/)cycleadmin(/<model>(/<action>(/<id>)))', array( 'lang' => $lang_options,
I have a rails route set up like: match ':controller/:id/:action' # match 'teams/:id' =>
My route looks like: routes.Add(new Route({companyName}/{action}/{id}, new MvcRouteHandler()) { Defaults = new RouteValueDictionary(new {
Having this route: map.foo 'foo/*path', :controller => 'foo', :action => 'index' I have the
I have the following route defined routes.MapRoute( ItemName, {controller}/{action}/{projectName}/{name}, new { controller = Home,
I have the following route: {language}/{controller}.mvc/{action}/{id} Once a user has choosen the language it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.