Cakephp: Problems with routing and paging

Asked

Viewed 103 times

0

I have a problem with the routes of CakePHP.

I have the following URL: http://www.nomedosite.com.br/Produtos/index/61/789/ And it works normally. The problem is when I go to the second page: http://www.nomedosite.com.br/Produtos/index/61/789/page:2

Error: The requested address '/Produtos/index/61/789/page:2' was not found on this server.

I entered a configuration entry in Config/Routes.php, but it didn’t work.

Router::connect(
    '/Produtos/index/:cat/:id/page:page', 
    [
        'controller' => 'Produtos',
        'action' => 'index'
    ],
    [
        'pass' => ['id', 'cat', 'page'],
        'id' => '[0-9]+',
        'cat' => '[0-9]+',
        'page' => '[0-9]+'
    ]
);

Can help me?

1 answer

0

Modify page:page for :page

Router::connect(
    '/Produtos/index/:cat/:id/:page', 
    [
        'controller' => 'Produtos',
        'action' => 'index'
    ],
    [
        'pass' => ['id', 'cat', 'page'],
        'id' => '[0-9]+',
        'cat' => '[0-9]+',
        'page' => '[0-9]+'
    ]
);

Note. I tested in Cakephp 2x

Browser other questions tagged

You are not signed in. Login or sign up in order to post.