mathi
mathi

Reputation: 107

multiple condtion in ternary opeartor is not working in tbbuttoncolumn in yii

$user_id = 66;
'visible'=>'(($data->message_kind==="ASKED") && 
              (Yii::app()->user>getState("userId")===$user_id))?true:false;'));

$user_id is not replacing value 66 ...please help me anyone....

Upvotes: 0

Views: 25

Answers (1)

Siim Kallari
Siim Kallari

Reputation: 861

You are converting this into a string with single quotes ', if you want to use variables inside string you would need to use double quotes ".

However in this case, you do not need to use quotes at all since all you are returning is true or false, so the proper code would be:

$user_id = 66;
'visible'=> (($data->message_kind==="ASKED") && 
              (Yii::app()->user>getState("userId")===$user_id))?true:false;));

Upvotes: 2

Related Questions