Lid |
|
Hoi,
Ik heb de code als volgt aangepast:
Wegschrijven in log:
function log_action($action, $message="") {
$logfile = SITE_ROOT.DS.'logs'.DS.'log.txt';
$new = file_exists($logfile) ? false : true;
$timestamp = strftime("%Y-%m-%d %H:%M:%S", time());
$content = "{$timestamp} | {$action}: {$message} \n";
$old_content = file_get_contents($logfile);
file_put_contents($logfile, $content . $old_content);
}
function log_action($action, $message="") { $logfile = SITE_ROOT.DS.'logs'.DS.'log.txt'; $content = "{$timestamp} | {$action}: {$message} \n"; file_put_contents($logfile, $content . $old_content); }
Uitlezen en tonen in admin sectie:
if( file_exists($logfile) && is_readable($logfile)) {
$log_content = file_get_contents($logfile);
var_dump($log_content);
$tpl->newBlock("frm_table_row");
$tpl->newBlock("frm_table_last_row");
$tpl->assign( array( "colspan" => "2", "align" => "left", "td_cell" => $log_content ) );
} else {
$tpl->newBlock("frm_table_row");
$tpl->newBlock("frm_table_last_row");
$tpl->assign( array( "colspan" => "2", "align" => "left", "td_cell" => "Could not read from {$logfile}.") );
}
$tpl->newBlock("frm_table_row"); $tpl->newBlock("frm_table_last_row"); $tpl->assign( array( "colspan" => "2", "align" => "left", "td_cell" => $log_content ) ); } else { $tpl->newBlock("frm_table_row"); $tpl->newBlock("frm_table_last_row"); $tpl->assign( array( "colspan" => "2", "align" => "left", "td_cell" => "Could not read from {$logfile}.") ); }
Wat ik nu krijg, is dat hij alle entries na elkaar op het scherm zet.
Hij plaatst ze dus niet regel per regel.
Dit terwijl ik bij het schrijven de \n parameter meegeef...
I'm lost!
EDIT: OPGELOST!! --> \r\n |