如果我從路由URL訪問它們,我無法爲分頁結果分頁。這些是我使用的路線:CakePHP 1.3.6中的分頁+路徑問題
// NEWS
Router::connect('/news.rss', array('controller' => 'posts', 'action' => 'index', 'ext' => 'rss'));
Router::connect('/news/*', array('controller' => 'posts', 'action' => 'index'));
Router::connect('/:lang/posts/*', array('controller' => 'posts', 'action' => 'index'));
我知道,在過去的路線,我沒有通過:郎參數,但如果我將它傳遞:
Router::connect('/:lang/news/*', array('controller' => 'posts', 'action' => 'index'), array('lang' => $regex['lang'], 'pass' => array('lang')));
它不工作。
如果我嘗試訪問url/news/page:2,它會顯示第一頁的結果。我打印出來,這 - $> PARAMS,看它是否正確需要的頁碼,並在一審中,它的作用:
Array
(
[lang] => ca
[named] => Array
(
[page] => 2
)
[pass] => Array
(
)
[controller] => posts
[action] => index
[plugin] =>
[url] => Array
(
[ext] => html
[url] => ca/posts/page:2
)
[form] => Array
(
)
[...]
)
陣列的這部分(我中省略了一些零件,我會以後告訴你)是相同的,如果我訪問/新聞/頁:2和/職位/索引/頁:2,但如果你看看這部分:
Array
(
[...]
[paging] => Array
(
[Post] => Array
(
[page] => 1
[current] => 3
[count] => 3
[prevPage] =>
[nextPage] =>
[pageCount] => 1
[defaults] => Array
(
[limit] => 3
[step] => 1
[order] => Post.created DESC
[conditions] => Array
(
[Post.active] => 1
[Post.page] =>
[0] => Post.public_date <= NOW()
)
)
[options] => Array
(
[page] => 1
[limit] => 3
[order] => Post.created DESC
[conditions] => Array
(
[Post.active] => 1
[Post.page] =>
[0] => Post.public_date <= NOW()
)
)
)
)
你可以看到,它不」請正確輸入頁碼。但是,如果我從/ posts/index/page訪問,它需要編號和分頁工作。
如果只是很漂亮的網址不打擾我,但考慮到該網站是多語言的,我至少需要那個作品,如果我訪問/ en/posts/index/page:2(或/ en/news/page 2)...
這裏是我的全部routes.php文件文件:
任何人有什麼正在發生的想法?
在此先感謝