控制器页面,ActionIndex使用小部件CListView
渲染页面在控制器中:
公共函数actionIndex()
{
model=新页面()
$this->render('index',array(
'pages'=>$model,
))
}
查看索引:
$this->widget('zii.widgets.CListView',数组(
"dataProvider"=>$dataProvider,
'viewData'=>数组('switch'=>true),
'enableHistory'=>true,'id'=>'pages_list',
'itemView'=>'_view',
"template"=>"{pager}
{items}
{pageer}",
));
现在是实际问题:
在ListView页面中,链接如下所示:
http://localhost/pages/index/pages_pages/1/
http://localhost/pages/index/pages_pages/2/
http://localhost/pages/index/pages_pages/3/
但在地址栏中插入链接时,这是不正确的。这些是:
Http://localhost/pages//pages/index/pages_page/3/=
当然,不要翻页
如果你重新移动到任何其他页面,链接的形式已经是:
Http://localhost/pages//pages/index//pages/index/pages_page/3///ajax/pages_list/pages_page/4/=
据我所知,有必要选择路由到URLManager的侧设置
只是不确定是什么。
您的控制器代码有一些错误。对actionIndex()使用以下内容。
/**
* Lists all models.
*/
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('Pages');
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
我测试了你的视图index.php代码,它运行得很好。
如果禁用enableHistory,效果良好。我找不到真正的解决方案
尝试删除
'id' => 'pages_list',
在视图中。