DoSelect( $sqlQuery ); $cRowPlain = $htmlOut->GetBlock( "CommentRow" ); $workRow = new SimpleTemplate(); $cRows = ""; if( $sqlRes ) { while( $curRow = mysql_fetch_array( $sqlRes ) ) { $workRow->TemplateData = $cRowPlain; $workRow->InsertVar( "from_name", $curRow['from_name'] ); $workRow->InsertVar( "from_location", $curRow['from_location'] ); $workRow->InsertVar( "comment_date", strftime( "%d-%b-%Y", strtotime( $curRow["comment_date"] ) ) ); $workRow->InsertVar( "comment", $curRow['comment'] ); $cRows[] = $workRow->TemplateData; } $htmlOut->ReplaceBlock( "CommentRow", implode( "\n", $cRows ) ); } else { $htmlOut->DeleteBlock( "CommentRow" ); } $htmlOut->Output(); ?>