在渲染每个页面示例之前,我必须检查用户是否已记录:
在开始检查用户是否登录,如果没有 - 重定向tom登录页面我不想在每个组件中添加它,如何对此进行操作?
我想从屏幕左侧到居中的一端做一条1像素的线div.以... div为中心margin: auto;.
此图显示了它应该如何显示:

我有两个模型:项目和用户.在项目中:
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
"users"=>array(self::MANY_MANY, 'User',
'projects_users(project_id, user_id)'),
);
}
Run Code Online (Sandbox Code Playgroud)
我想列出实际项目中的所有用户,$ model包含实际项目:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'user-grid',
'dataProvider'=>$model->users,
'columns'=>array(
'ID',
'username',
'displayname',
'firstname',
'lastname',
'email',
/*
'password',
'isAdmin',
*/
array(
'class'=>'CButtonColumn',
'template'=>'{delete}',
),
),
)); ?>
Run Code Online (Sandbox Code Playgroud)
不幸的是我收到了一个错误:
Fatal error: Call to a member function getData() on a non-object in /var/www/vhosts/aevers.com/editor/framework/zii/widgets/CBaseListView.php on line 107
Run Code Online (Sandbox Code Playgroud)