开发者

Drupal's ticketyboo module - limit results

I'm using the ticketyboo module for Drupal and i'm trying to get the module to only pick the last 3 node items. The module itself doesn't have function built in to do this.

The module php code is as follows;

   // build the ticker contents
   switch ($selection) {
      case 'node':
         $nodes = explode(',', $nodes);
         break;
      case 'type':
         $r = db_query("SELECT DISTINCT nid FROM {node} WHERE type ='%s'", trim($nodes));
         $nodes = array();
         while ($n = db_fetch_array($r)) {$nodes[] = $n['nid'];}
         break;
      case 'taxonomy':
         $r = db_query("SELECT DISTINCT nid FROM {term_node} WHERE tid in (%s)", $nodes);
         $nodes = array();
         while ($n = db_fetch_array($r)) {$nodes[] = $n['nid'];}
         break;
   }
   $ret = '';
   $i=0;
   foreach ($nodes as $nid) {
      $node = node_load(trim($nid));
      if ($i > 0) {
         $ret .= '<div style="'.$pad_style.'"></div>';
      }
      $ret .= '<div id="ticketyboo_'.$delta.'_'.$i.'" class="ticketyboo_teaser" style="'.$item_style.'">';
      $ret .= '<a href="/node/'.$node->nid . '">'.开发者_JS百科$node->title . '</a>';
      $ret .= '</div>';
      $i++;
   }

I was thinking I could just use LIMIT, but it looks like I need to build up a query in the case 'node'.

I would be grateful if anyone might be able to help. :)

Thank you.


You're more likely to get answers in the issue queue of that module at http://drupal.org/project/ticketyboo - file a support request

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜