- Войдите, чтобы оставлять комментарии
$type = 'news';
$perpage = variable_get('nodes_per_page_for_'.$type, 10);
$result = pager_query('
SELECT n.*, nr.teaser, nr.format, f.filepath, cta.field_images_data
FROM {node} n
INNER JOIN {node_revisions} nr ON nr.nid = n.nid AND nr.vid = n.vid
LEFT JOIN {content_field_images} cta ON cta.vid = n.vid AND cta.delta = 0
LEFT JOIN {files} f ON f.fid = cta.field_images_fid
WHERE n.type = \''.$type.'\' AND n.status = 1
GROUP BY n.nid
ORDER BY n.sticky DESC, n.created DESC
', $perpage, 0, 'SELECT COUNT(*) FROM {node} n WHERE n.type = \''.$type.'\' AND n.status = 1');
$nodes = array();
while ($node = db_fetch_object($result)) {
$nodes[$node->nid] = $node;
}
foreach ($nodes as $nid => $node) {
$node->field_images_data = unserialize($node->field_images_data);
if ($node->filepath != '') $node->img = theme('rustex_ext_highslide_image', $node->filepath, $node->field_images_data['description']);
echo node_view($node, TRUE);
}
echo theme('pager', array('«', '‹', '', '›', '»'));
?>
