$query = "SELECT
arc.*,tp.typedir,tp.typename,
tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON
tp.id=arc.typeid
WHERE arc.id in($ids) ORDER BY arc.{$order} $orderway ";