Nodes auflisten, die im Titel einen bestimmten String enthalten

  • <?php
         
    // Text, der enthalten sein soll
         
    $string = "Gasthof";

         
    // maximum number of items to show:
         
    $count = 6;

         
    $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title
          FROM {node} n
          WHERE n.title LIKE '%$string%' AND
          n.status = 1
          ORDER BY n.title DESC"
    ),$string,0,$count);

          while (
    $node = db_fetch_object($result)) {
           
    $items[] = l($node->title, 'node/'. $node->nid);
          }
         
    $output = theme('item_list', $items);
          print
    $output;
    ?>

Siehe auch

Klassifikation