Hi,
I want to change cell's style depending on a value.
I try to use this syntax (smarty) on the template but it doesn't work :
{if $MAJ_semaine_value=='x'}
<td class=data>{$MAJ_semaine_value}</td>
{else}
<td class=data1>{$MAJ_semaine_value}</td>
{/if}
Could you help me.
Thanks and sorry for my english.
JC
Have a look for conditional formating in this forum there are a few examples. Here's mine and it works like a charm. I am no expert but found a lot of help in this forum and Jane and Sergey are really good at helping out. THANKS
I am guessing you are french so to make it easier for you here's the commenst in french:
Dans mon exemple, 'DURATION' est mon champ conditionnel, si sa valeur depasse 1, le format de la cellule ou de la ligne change de couleur, a toi de choisir ce qui te convient. C'est dans Custom View dans PHPR ou tu dois choisir ton champ puis inserer le code ci-dessous.
Conditional formating: add in custom view in design
global $data;
$str = "<font color=";
if ($data["DURATION"]<"0.5")
$str.="green";
if ($data["DURATION"]>"0.5" and $data["DURATION"]<"1")
$str.="yellow";
if ($data["DURATION"]>"1")
$str.="red";
$str.=">".$value."</font>";
$value=$str;
------or---------------------
global $data;
$str = "<table width=100% bgcolor=";
if ($data["DURATION"]<"0.5")
$str.="green";
if ($data["DURATION"]>"0.5" and $data["DURATION"]<"1")
$str.="green";
if ($data["DURATION"]>"1")
$str.="red";
$str.="><tr><td>".$value."</td></tr></table>";
$value=$str;