color change depends on the value

merlino68

Member
in a calculated field (field_a) I have the following code PHP

if ((int)'{tm_allenamenti___gg_scad}'>=1) {$spoints = "Scaduto";}
else
if ((int)'{tm_allenamenti___gg_scad}'<=-7) {$spoints = "Attivo";}
else
$spoints = "In scadenza";
return $spoints;
and it works.:)

Now I would like that if the value of field_a = "expired" the text color is red
if the value of field_a = "active" the text color is green
if the value of field_a = "maturing" the text color is yellow

you can do this?
php or CSS ?
 
Thanks for the answer
Unfortunately I was not familiar CSS, you can explain step by step where to put the code?

CSS in the cell?
In your code, where I put the color?
________
.my-info .mc_contract_products___billing_start {
.alert-info;
}
.my-warning .mc_contract_products___billing_start {
.alert;
}
.my-success .mc_contract_products___billing_start {
.alert-success;
}
_____
Thanks and sorry for my "bad" english
 
You can find a good explanation on the WIKI

If you are unfamiliar with css, be careful that these are both class names, the .my-success gets attached to the row and the .mc_contract_products___billing_start is the cell class

by following 2 class names you telling css to find 2 these classed nested one after the other. You should be able to check your names by looking in the browser debugger.

Regards,
Paul
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top