This topic is locked

master table list before record processed

9/5/2010 3:50:06 AM
PHPRunner General questions
G
garethp authorDevClub member

Hi
I have applied the following code to a list page: after record processed and print page: after record processed to make the background change colour programatically...

if($data["10_10"]== 10 )

$record["10_10_style"]='style="background:red"';


This works great. However the table/view this is applied to has details table. When you select the details link the master table appears at the top of the page as required but I can not see any way to add this code to make the formatting work for this master table section. The list page formatting is utilised for any changes made in the visual editor but not the event coding is ignored.
Can you help?
Many thanks
Gareth

G
garethp authorDevClub member 9/9/2010

Hi all
Can anyone help on this - last piece of a project to solve you see.
Many thanks
Gareth

A
ann 9/9/2010

Gareth,
unfortunately there is no easy way to do it in PHPRunner.

You need to create such table manually then.

Here is a sample (Before display event of the child table):

if ($_REQUEST["masterkey1"]){

$rs=CustomQuery("select * from master where Ch_Id=".$_REQUEST["masterkey1"]);

$data=db_fetch_array($rs);

$str="<b>Master: [Ch_Id: ".$_REQUEST["masterkey1"]."]</b>
<TABLE CELLPADDING=4 CELLSPACING=1 BORDER=0

style=\"width:20%;margin:5px 0;border: solid; border-width: 1px; border-color: #C0C0C0;\" class=\"data\">
<!-- header -->

<tr class=\"blackshade\" valign=\"top\">

<td>Field1</td>

<td>Id</td>

<td>Ch Id</td>

</tr>

<!-- data -->

<tr class=\"shade\">";

if ($data["Field1"]==10){

$str.="<td bgcolor=\"red\">";

}

else{

$str.="<td>";

}

$str.=$data["Field1"]."{Field1_mastervalue}

</td>

<td>

".$data["Id"]."{Id_mastervalue}

</td>

<td>

".$data["Ch_Id"]."{Ch_Id_mastervalue}

</td>

</tr>

</table>";

}



You can copy such code snippet from the generated mastertablename_masterlist.htm file and edit it.