As far as I understand, the pagination module was excluded from the Kohans. As a result, going to version 3.3, I wrote it for myself. And it seems to be working, but the trouble is that it looks like:

Route::set('cp.pagination', '<directory>(/<controller>(/<action>(/page/<page>)(/<id>)))', array('page' => '[0-9]+')) ->defaults(array( 'directory' => 'cp', 'controller' => 'index', 'action' => 'index', )); 

It worked fine on 3.2 but on 3.3 the exception crashes:

 Kohana_Exception [ 0 ]: Required route parameter not passed: id 

How to solve this problem or can we put a more universal router for pagination? You do not want to produce 3-4 routing rules when you can get by with the general rule. And where you can read about the changes in routs on version 3.3

Well, then question 3.3 adopted the PSR-0 standard directory and file names should be capitalized. How will this affect linux hosting will work the same URL of the type Directory / Controller / Action / and directory / controller / action,

    2 answers 2

    About routes . If you google "Required route parameter not passed kohana 3.3", you can stumble upon the page of. forum , where there is a conversation about the error due, as I understand it, nevlozhennyh optional parameters:


    Corrected in 3.3.1.

    There is a temporary solution - to set the variable in defaults empty. Like this:

     ->defaults(array( 'directory' => 'cp', 'controller' => 'index', 'action' => 'index', 'page' => '', // вот это оно )); 

    But even for version 3.2, the authors advised to use as many routes as necessary.

    Regarding the standard for names , in the source ucwords Route::matches() skips ucwords , then everything will work.
    In order not to alter anything at all (or alter gradually):

     spl_autoload_register(array('Kohana', 'auto_load_lowercase')); // см. bootstrap.php:49 
    • Of course, they are wonderful advise. But in my opinion, as it is not very humanely, produce 2 rules for one that would work out both dir / controller / action / page and dir / controller / action / id / page! It's sad that this is a bug. Don't they have a release schedule? - BASSON_XVI
    • On the contrary, it’s good that the bug would not have been corrected :) I don’t know anything about the schedule, but there seems to be a solution : set this variable in defaults as empty: -> defaults (array ('directory' => 'cp', 'controller' => 'index', 'action' => 'index', 'page' => '', // this is it)); Unsubscribe if it works. - xEdelweiss
    • Yes, if you create a router like this: <pre> <directory> (/ <controller> (/ <action> (/ <id>) (/ page / <page>))) </ pre> then yes, the page is blocked by defaults helps Thanks for the answer! - BASSON_XVI 5:26
    • Fine, I will update the answer. - xEdelweiss

    Better yet, transfer pages to $ _GET. This makes routing easier and easier to program. In addition, your route is the CNC for the $ _GET array.