如果我从路由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文件文件:
任何人有什么正在发生的想法?
在此先感谢