/* 函数 tableFormat( $records, $cols=5, $colsKey="TD" )
** 功能 将数据转换为表格格式
** 参数 $records 数组记录
** 参数 $cols 表格中每行显示的记录数
** 参数 $colsKey 数组中每行的键名
*/
function tableFormat( $records, $cols=5, $colsKey="TD" )
{
$ROWS = array();
while( $col = array_splice( $records, 0, $cols ) )
{
$ROWS[][$colsKey] = $col;
}
return $ROWS;
}以你的为例
假设想输出每行5列
$artList = tableFormat($artList, 5, "column");
$tpl->assign("row", $artList);