3.2.0

Please Help, Why AW not working in my php code?

<?php
$file = "AwPhp-text.txt";
function aw_cells($file){
 header("Pragma: public");
 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
 header("Cache-Control: must-revalidate");
 header("Content-type: text");
 header("Content-Length: ".filesize($file));
 header("Content-disposition: inline; filename=$file");
 header("Accept-Ranges: ".filesize($file));

 $fp = fopen($file, 'rb');
 $buffer = fread($fp, filesize($file));
 fclose ($fp);
 echo $buffer;
}
?>
<html>
<head>
<link href="aw.css" rel="stylesheet" type="text/css" >
<script src="aw.js"></script>
</head>
<body>
<script>
 var myCells = <?= aw_cells($file) ?>;
 var obj = new AW.UI.Grid;
 obj.setCellText(myCells);
 obj.setColumnCount(4);
 obj.setRowCount(5);
 document.write(obj);
</script>
</body>
</html>


// *************************************
AwPhp-text.txt
// *************************************

["MSFT","Microsoft Corporation", "314,571.156", "32,187.000"],
["ORCL", "Oracle Corporation", "62,615.266", "9,519.000"],
["SAP", "SAP AG (ADR)", "40,986.328", "8,296.420"],
["CA", "Computer Associates Inter", "15,606.335", "3,164.000"],
["ERTS", "Electronic Arts Inc.", "14,490.895", "2,503.727"]
// *************************************

I tested seperatly php code and htm. if i remove the html portion the cache and file reading process works fine, if i remove php code and run html by follow the below my cell value, it can works too.
but if i combine both it totaly returns nothing. please help how to do this?

var myCells = [
["MSFT","Microsoft Corporation", "314,571.156", "32,187.000"],
["ORCL", "Oracle Corporation", "62,615.266", "9,519.000"],
["SAP", "SAP AG (ADR)", "40,986.328", "8,296.420"],
["CA", "Computer Associates Inter", "15,606.335", "3,164.000"],
["ERTS", "Electronic Arts Inc.", "14,490.895", "2,503.727"]
];

I want to run this php code on ie 6, since ie 6 not support avoid cache, i can do this in php run on the same ie6, actuall my need in such i need to refresh the grid table every 3 seconds 1s. very urgent pls help






Steve
September 25,
You may have a problem with PHP because you are calling the header() function after you start sending html content. Try loading the file upfront, before starting with html.

<?php
$file = "AwPhp-text.txt";
function aw_cells($file){
...
return $buffer;
}

$data = aw_cells($file);
?>
<html>
...
<script>
 var myCells = <?= $data ?>;
...
Alex (ActiveWidgets)
September 26,

This topic is archived.

See also:


Back to support forum