$addField .= ",".$addtable.".".$k." as ".$arr['rename'];
}
else
{
$addField .= ",".$addtable.".".$k;
}
}
}
}
}
//排序方式
$ordersql = "";
if($orderby=="senddate")
{
$ordersql=" ORDER BY arc.senddate $orderWay";
}
else if($orderby=="pubdate")
{
$ordersql=" ORDER BY arc.pubdate $orderWay";
}
else if($orderby=="id")
{
$ordersql=" ORDER BY arc.id $orderWay";
}
else if($orderby=="hot"||$orderby=="click")
{
$ordersql = " ORDER BY arc.click $orderWay";
}
else if($orderby=="lastpost")
{
$ordersql = " ORDER BY arc.lastpost $orderWay";
}
else if($orderby=="scores")
{
$ordersql = " ORDER BY arc.scores $orderWay";
}
else if($orderby=="rand")
{
$ordersql = " ORDER BY rand()";
}
else if($orderby=="price") //自定义商品频道按价格排序
{
$ordersql = " ORDER BY ".$addtable.".price";
}
else
{
$ordersql=" ORDER BY arc.sortrank $orderWay";
}
保存关闭。
至此,大功告成,如需添加其他字段,按照此方法处理即可。
此方法较适用于分类不太多的情况,如果分类太多,那生成的列表就太多,需要考虑别的解决方案了。