Список документов определённых типов с формированием обзорных страниц


Автор документа

Имя
Сергей

Сайт
http://sergey.vilgelm.googlepages.com/

За основу был взят предыдущий сниппет и переделан. В отличии от своего родителя, этот сниппет позволяет отображать документы нескольких типов и, что самое главное, прикрепленные документы отображаются в начале страницы.

<?php
    $content_type
= array (
       
'story' => true,
       
'projects' => true
   
);
   
$ct_for_sql = '(';
   
$delim = false;
    foreach (
$content_type as $type => $show) {
        if (
$show) {
            if (
$delim) {
               
$ct_for_sql .= ', ';
            } else {
               
$delim = true;
            }
           
$ct_for_sql .= '\''.$type.'\'';
        }
    }
   
$ct_for_sql .= ')';
   
$result = pager_query(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.type IN '.$ct_for_sql.' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'));
    while (
$node = db_fetch_object($result)) {
       
$output .= node_view(node_load(array('nid' => $node->nid)), 1);
    }
   
$output .= theme('pager', NULL, $listlength);
    print
$output;
?>

Comments

Сергей,
огромное Вам спасибо - очччень удобный и необходимый инструмент!

Post new comment

The content of this field is kept private and will not be shown publicly.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.