Return to Snippet

Revision: 51959
at October 8, 2011 10:38 by bisaram


Initial Code
<div class="rubricator">
<?php
$vid = 1;
$db_result = db_query_range( "SELECT
                                d.tid,
                                d.name,
                                MAX(n.created) AS updated,
                                COUNT(*) AS count
                              FROM
                                {term_data} d
                              INNER JOIN
                                {term_node}
                              USING
                                (tid)
                              INNER JOIN
                                {node} n
                              USING
                                (nid)
                              WHERE
                                d.vid = %d AND
                                n.status = 1 AND
                                n.type = '%s'
                              GROUP BY
                                d.tid,
                                d.name
                              ORDER BY
                                COUNT DESC",
                              $vid, 'my_node_type', 0, 10 );
$items = array();
while ( $category = db_fetch_object( $db_result ) ) {
  $items[] = l( $category -> name , 'taxonomy/term/'. $category -> tid ) . ' (' . $category -> count . ')';
}
print theme( 'item_list', $items );
?>
</div>

Initial URL

                                

Initial Description

                                

Initial Title
Drupal Rubricator

Initial Tags
drupal

Initial Language
PHP