This topic is locked
[SOLVED]

 View As 'Custom' for PHPrunner

12/26/2006 3:28:09 PM
PHPRunner General questions
G
Gary.Beam author

I need help with some Custom cell fromatting using PHPrunner. I tried to use/modify your Cell Background Color example for ASPrunner without success. Could you post an example showing how to set a cell background color to 'green' when the cell TEXT data == "Normal" and 'red' when the data != "Normal".
Thanks, Gary

Sergey Kornilov admin 12/26/2006

Something like this will work:

if ($value=="Normal")

$value = "<table width=100% color=green><tr><td>" . $value . "</td></tr></table>";

else

$value = "<table width=100% color=red><tr><td>" . $value . "</td></tr></table>";
G
Gary.Beam author 12/26/2006

[quote name='admin' post='14087' date=Dec 26 2006, 02:15 PM]Something like this will work:
<!--c1-->[codebox]// return custom expression

function CustomExpression($data,$field,$table="")

{

global $strTableName;

if(!$table)

$table=$strTableName;

$value=$data[$field];

if($table=="tour_data" && $field=="Status")

{

if ($value=="Normal")

$value = "<table width=100% color=green><tr><td>" . $value . "</td></tr></table>";

else

$value = "<table width=100% color=red><tr><td>" . $value . "</td></tr></table>";

}

return $value;

}[/codebox]
Am I missing something simple?

J
Jane 12/27/2006

Gary,
this issue is resolved in the latest PHPRunner 3.1.

Please try it out:

http://www.asprunner.com/files/phprunner311.exe

http://www.asprunner.com/files/phprunner311.zip
Also here is the correct code for the Custom "View as" format:

if ($value=="Normal")

$value = "<table width=100% bgcolor=green><tr><td>" . $value . "</td></tr></table>";

else

$value = "<table width=100% bgcolor=red><tr><td>" . $value . "</td></tr></table>";

G
Gary.Beam author 12/27/2006

[quote name='Jane' date='Dec 26 2006, 10:57 PM' post='14090']

Gary,
this issue is resolved in the latest PHPRunner 3.1.

Please try it out:

http://www.asprunner.com/files/phprunner311.exe

http://www.asprunner.com/files/phprunner311.zip
Jane,
I am using PHPRunner 3.1 build 181, which I believe is the same as the links above. The problem is the same. The browser displays the Custom Code as TEXT in the table cell.
Thanks, Gary

Sergey Kornilov admin 12/27/2006

Gary,
post your files to Demo Account and send me a link.