In the database, there is a column is_starred
which value is either 0
or 1
. Depending on 0
or 1
, I want to display a div with class in the column of CGridView in admin. i.e. if the values is 0
, I want to display the div as <div class="bookmark">☆</div>
or if the values is 1
, I want to display <div class="bookmark active">☆</div>
. How can I do this could you me anybody please.
<div class="bookmark <?php echo ($is_starred == 1) ? "active" : ""; ?>">☆</div>
This presumes that the database value is stored in a variable named $is_starred
.