This topic is locked

Colour row background according to field value

2/11/2007 12:48:55 PM
PHPRunner General questions
T
thesofa author

I have read the post here about it , I wondered if there is a solution that works for version 3.1?

J
Jane 2/12/2007

Hi,
you can do the following:

  1. proceed to the Visual Editor tab, turn on HTML mode, find following line:
    <TR onmouseover="this.className = 'rowselected';" onmouseout="this.className = '{$row.shadeclassname}';" vAlign=top {$row.shadeclass}>

and replace it with this one:

<TR {if $row.1FieldName_value=="value1"} class=shade_value1{/if} {if $row.1FieldName_value=="value2"} class=shade_value2{/if} vAlign=top>



where FieldName is your actual field name.
2. open generated include/style.css file and add your code in it. Here is a sample:> .shade_value1

{

COLOR: #000000; / was 333333 /

BACKGROUND-COLOR: #CCCCCC; /#FFFFFF;/

}

.shade_value2

{

COLOR: #333333;

BACKGROUND-COLOR: #FF9999; /#c64444; #FF0000;/

}

M
mrpeeble 5/7/2007

I tried this in my project, the code now looks like this in the _main_list.htm:
<TR vAlign=top {if $row.1Pickup_value==1} class=shade_value2{/if} {if $row.1Pickup_value==2} class=shade_value1{/if}>
the field is a foreign key called 'Pickup'
the css was modified as well as per the instructions.
When I run it, the formatting has not changed. Am I doing something wrong?

Hi,

you can do the following:

  1. proceed to the Visual Editor tab, turn on HTML mode, find following line:

    and replace it with this one:

    where FieldName is your actual field name.
  2. open generated include/style.css file and add your code in it. Here is a sample:

J
Jane 5/8/2007

Hi,
it's difficult to tell you what's happening without seeing actual files.

You can send to [email=support@xlinesoft.com]support@xlinesoft.com[/email] your database script along with all generated PHP files for investigation.