SOLVED:Date won't show on output file
Posted: Thu Apr 03, 2008 8:32 am
I am trying to edit an app to write the publishing date to the top module template that pieced together with the middle row and bottom row are writen to a .mod and then loaded into a regular html by server side include.
Currently the table with all the other variables show ok but the date is not written at all.
I have the following code:
// Get table elements
$tableTop = file($modTop);
$tableBot = file($modBot);
$tableRow = file($modRow);
// Recover all submitted data
$inDate = $_POST['date'][$i];
$tokens2 = array("###PUBLISH_DATE###");
$convert2 = array($inDate);
$top = str_replace($tokens2,$convert2,$tableTop);
$tableSet = array_merge($top);
for ($i = 0; $i < count($_POST['key']); $i++) {
$inKey = str_pad(intval($_POST['key'][$i]), 4, '0', STR_PAD_LEFT);
$inCode = $_POST['code'][$i];
$maturity = $_POST['maturity'][$i];
$yield = number_format($_POST['yield'][$i], 2, ".", "");
$bidPrice = number_format(abs($_POST['bid'][$i]), 2, ".", "");
$tradeFee = number_format(abs($_POST['fee'][$i]), 2, ".", "");
$proceeds = $_POST['proceeds'][$i];
$endDate = $_POST['endDate'][$i];
// Assemble table
$value = $activeIssue[$inKey];
$iKey = $value[0];
$iCode = $value[1];
$issue = str_replace("&_", "&", $value[2]);
$iUrl = $value[3];
$iDate = $value[4];
$tokens = array("###ISSUE_CODE###","###ISSUE###","###URL###","###ISSUE_DATE###","###MATURITY###","###YIELD###","###BID###","###FEE###","###PROCEEDS###","###END_DATE###");
$convert = array($inCode,$issue,$iUrl,$iDate,$maturity,$yield,$bidPrice,$tradeFee,$proceeds,$endDate);
$logData[] = array($inKey,$iCode,$issue,$iUrl,$iDate,$maturity,$yield,$bidPrice,$tradeFee,$proceeds,$endDate,$inDate);
$row = str_replace($tokens,$convert,$tableRow);
$tableSet = array_merge($tableSet,$row);
}
$tableSet = array_merge($tableSet, $tableBot);
After this it writes to the file on server. The writing of the file works fine. It's the date part I am getting stuck at.
As it stands the $inDate variable is not written to the log either.
Can anybody point me in the right direction here?
Thank you in advance,
FayeC
P.S.
The correct code is:
// Recover date variable and write top module date
$tokens2 = array("###PUBLISH_DATE###");
$convert2 = array(date("F n, Y h:i A T"));
$top = str_replace($tokens2,$convert2,$tableTop);
$tableSet = array_merge($top);
// Recover all submitted data so it can be written to row module using a loop
for ($i = 0; $i < count($_POST['key']); $i++) {
$inKey = str_pad(intval($_POST['key'][$i]), 4, '0', STR_PAD_LEFT);
$inCode = $_POST['code'][$i];
$maturity = $_POST['maturity'][$i];
$yield = number_format($_POST['yield'][$i], 2, ".", "");
$bidPrice = number_format(abs($_POST['bid'][$i]), 2, ".", "");
$tradeFee = number_format(abs($_POST['fee'][$i]), 2, ".", "");
$proceeds = $_POST['proceeds'][$i];
$endDate = $_POST['endDate'][$i];
// Assemble table
$value = $activeIssue[$inKey];
$iKey = $value[0];
$iCode = $value[1];
$issue = str_replace("&_", "&", $value[2]);
$iUrl = $value[3];
$iDate = $value[4];
$tokens = array("###ISSUE_CODE###","###ISSUE###","###URL###","###ISSUE_DATE###","###MATURITY###","###YIELD###","###BID###","###FEE###","###PROCEEDS###","###END_DATE###");
$convert = array($inCode,$issue,$iUrl,$iDate,$maturity,$yield,$bidPrice,$tradeFee,$proceeds,$endDate);
$logData[] = array($inKey,$iCode,$issue,$iUrl,$iDate,$maturity,$yield,$bidPrice,$tradeFee,$proceeds,$endDate);
$row = str_replace($tokens,$convert,$tableRow);
$tableSet = array_merge($tableSet,$row);
}
$tableSet = array_merge($tableSet, $tableBot);
Currently the table with all the other variables show ok but the date is not written at all.
I have the following code:
// Get table elements
$tableTop = file($modTop);
$tableBot = file($modBot);
$tableRow = file($modRow);
// Recover all submitted data
$inDate = $_POST['date'][$i];
$tokens2 = array("###PUBLISH_DATE###");
$convert2 = array($inDate);
$top = str_replace($tokens2,$convert2,$tableTop);
$tableSet = array_merge($top);
for ($i = 0; $i < count($_POST['key']); $i++) {
$inKey = str_pad(intval($_POST['key'][$i]), 4, '0', STR_PAD_LEFT);
$inCode = $_POST['code'][$i];
$maturity = $_POST['maturity'][$i];
$yield = number_format($_POST['yield'][$i], 2, ".", "");
$bidPrice = number_format(abs($_POST['bid'][$i]), 2, ".", "");
$tradeFee = number_format(abs($_POST['fee'][$i]), 2, ".", "");
$proceeds = $_POST['proceeds'][$i];
$endDate = $_POST['endDate'][$i];
// Assemble table
$value = $activeIssue[$inKey];
$iKey = $value[0];
$iCode = $value[1];
$issue = str_replace("&_", "&", $value[2]);
$iUrl = $value[3];
$iDate = $value[4];
$tokens = array("###ISSUE_CODE###","###ISSUE###","###URL###","###ISSUE_DATE###","###MATURITY###","###YIELD###","###BID###","###FEE###","###PROCEEDS###","###END_DATE###");
$convert = array($inCode,$issue,$iUrl,$iDate,$maturity,$yield,$bidPrice,$tradeFee,$proceeds,$endDate);
$logData[] = array($inKey,$iCode,$issue,$iUrl,$iDate,$maturity,$yield,$bidPrice,$tradeFee,$proceeds,$endDate,$inDate);
$row = str_replace($tokens,$convert,$tableRow);
$tableSet = array_merge($tableSet,$row);
}
$tableSet = array_merge($tableSet, $tableBot);
After this it writes to the file on server. The writing of the file works fine. It's the date part I am getting stuck at.
As it stands the $inDate variable is not written to the log either.
Can anybody point me in the right direction here?
Thank you in advance,
FayeC
P.S.
The correct code is:
// Recover date variable and write top module date
$tokens2 = array("###PUBLISH_DATE###");
$convert2 = array(date("F n, Y h:i A T"));
$top = str_replace($tokens2,$convert2,$tableTop);
$tableSet = array_merge($top);
// Recover all submitted data so it can be written to row module using a loop
for ($i = 0; $i < count($_POST['key']); $i++) {
$inKey = str_pad(intval($_POST['key'][$i]), 4, '0', STR_PAD_LEFT);
$inCode = $_POST['code'][$i];
$maturity = $_POST['maturity'][$i];
$yield = number_format($_POST['yield'][$i], 2, ".", "");
$bidPrice = number_format(abs($_POST['bid'][$i]), 2, ".", "");
$tradeFee = number_format(abs($_POST['fee'][$i]), 2, ".", "");
$proceeds = $_POST['proceeds'][$i];
$endDate = $_POST['endDate'][$i];
// Assemble table
$value = $activeIssue[$inKey];
$iKey = $value[0];
$iCode = $value[1];
$issue = str_replace("&_", "&", $value[2]);
$iUrl = $value[3];
$iDate = $value[4];
$tokens = array("###ISSUE_CODE###","###ISSUE###","###URL###","###ISSUE_DATE###","###MATURITY###","###YIELD###","###BID###","###FEE###","###PROCEEDS###","###END_DATE###");
$convert = array($inCode,$issue,$iUrl,$iDate,$maturity,$yield,$bidPrice,$tradeFee,$proceeds,$endDate);
$logData[] = array($inKey,$iCode,$issue,$iUrl,$iDate,$maturity,$yield,$bidPrice,$tradeFee,$proceeds,$endDate);
$row = str_replace($tokens,$convert,$tableRow);
$tableSet = array_merge($tableSet,$row);
}
$tableSet = array_merge($tableSet, $tableBot);