问题描述
我有以下问题:
当我在分页中按下按钮时,CLinkPager会生成如下链接:
When I press a button in my pagination, CLinkPager generates the link as follows:
page/videos/445/?page=2
-
我需要的是这样的东西:
What I need is something like this:
page/videos/445/page/2
page/videos/445/page/2
此外,我需要类似的东西:
Furthermore, I need something like:
名称/视频/2
其中名称是user_id的URL = 445.
where name is url of user_id = 445.
我已经在urlManager中设置了一些规则,但是它们并不能完全解决这个问题:对于步骤1:
I've set some rules in urlManager but they don't quite do the job:For step 1:
'<controller:\w+>/<action:\w+>/<id:\d+>/<page:\d+>' => '<controller>/<action>',
感谢您的帮助.预先谢谢你!
Any help is appreciated. Thank you in advance!
推荐答案
这里是page/videos/445/page/2的示例.这将帮助您理解:
Here example for page/videos/445/page/2.This will help you understand:
//config
'rules'=>array(
'page/videos/<number:\d+>/page/<pageId:\d+>' => '/site/test',
...
//...SiteController...
//url for call www.your_site.lh/page/videos/445/page/2
public function actionTest($number, $pageId)
{
echo '<pre>';
print_r($_GET);
echo "$number<br/>";
echo "$pageId<br/>";
echo '</pre>';
die();
}
如果要在寻呼机中更改生成链接,可以覆盖CLinkPager.
If you want to change generation links in pager you can override CLinkPager.
这篇关于Yii CLinkPager& urlManager规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!