我用前缀设置了路由admin
,我遇到问题的页面有这个路径:
http://mydomain.com/admin/posts
我希望这是一个分页的博客文章列表。该 URL 调用admin_index
我的posts
控制器中的操作。很简单。
在我的观点的底部,我有这个:
<?php echo $this->Paginator->numbers(array('first' => 1, 'last' => 1, 'separator' => '')); ?>
但是,分页链接将我发送到一个不存在的 URL:
http://mydomain.com/posts/admin_index/page:2
我需要它来生成一个链接,例如:
http://mydomain.com/admin/posts/2
我怎样才能做到这一点?我已经尝试像这样设置我的分页器选项:
<?php $this->Paginator->options(array(
'url'=> array('controller' => 'posts',
'action' => 'index',
'prefix' => 'admin'
))); ?>
但这会使 URL 像这样:
http://mydomain.com/posts/index/prefix:admin/page:2
我怎样才能让它工作?