Php Yii CLinkPager更改链接页面
在我的项目中,我想更改链接url,因为它看起来不太好。Php Yii CLinkPager更改链接页面,php,yii,Php,Yii,在我的项目中,我想更改链接url,因为它看起来不太好。 链接如下所示: http://www.example.com/product?Product[pagesize]=24&页面=2 http://www.example.com/product?Product[品牌标识][]=3 所以我想把url改成这样 http://www.example.com/product?brd[]=3 我使用Yii framewrok,是否可以更改它? 谢谢大家! 我不知道你为什么使用困难的url而不是
链接如下所示:
- http://www.example.com/product?Product[pagesize]=24&页面=2
- http://www.example.com/product?Product[品牌标识][]=3
- http://www.example.com/product?brd[]=3
谢谢大家! 我不知道你为什么使用困难的url而不是yii的数据提供者进行分页。以下是代码: 控制器:
$pageSize=5;
$news = News::model()->findAll(); //returns AR objects
$count = count($news);
$dataProvider= new CArrayDataProvider($news, array(
'sort'=>array('attributes'=>array('title')), //you can sort here if objects not sorted
'pagination'=>array('pageSize'=>$pageSize),
));
$models = $dataProvider->getData();
$this->render('index', array(
'models' => $models,
'dataProvider' => $dataProvider,
'itemCount' => $count,
));
查看:
<?php
$this->widget('CLinkPager', array(
'pages'=>$dataProvider->pagination,
));
?>
是的,这种格式真的没有用。为什么使用这种格式?因为我在模型(产品)中使用它,所以当我导航它时,url会像我发布的那样更改。不客气,您应该单击“检查”按钮来解决此问题