I put it into some view like admin view, index view, etc.
this is from index view :
<?php
/* @var $this UserController */
/* @var $dataProvider CActiveDataProvider */
$this->breadcrumbs = array(
'Users',
);
$this->menu = array(
array('label' => 'Create User', 'url' => array('create')),
array('label' => 'Manage User', 'url' => array('admin')),
array('label' => 'Download Member Card', 'url' => array('pdf', 'id' => $model->id_user)), //here it is
);
?>
<h1>Users</h1>
<?php
$this->widget('zii.widgets.CListView', array(
'dataProvider' => $dataProvider,
'itemView' => '_view',
));
?>
konapaz
(Konapaz)
22
Are you sure tha the $model is not null? check with var_dump ($model) and see if related user has id
Keith
(Kburton)
23
I would guess you’re not passing a $model instance into the view. Realistically, it’d make more sense to use the logged in user’s ID, so:
'url' => array('pdf', 'id'=>Yii::app()->user->id)
Of course, you’ll need to ensure it’s only used when a user is logged in; ie. Yii::app()->user->isGuest is false.
that url give me this error : Property “CWebUser.id_user” is not defined.
I already add this !Yii::app()->user->isGuest
no, it’s not null. if it is null, then there are nothing appears in my view
Keith
(Kburton)
26
You’re not using id_user. Make sure you’ve used id, not id_user.
wow, you like a genie that knows everything LOL.
thanks it works now
konapaz
(Konapaz)
28
what is shown with var_dump? Does the user id show in properly way?