I apologize in advance for my ignorance. I really have attempted to search for answers on this but to no avail. I'm trying to learn as fast as I can :)

I've used this following code to pull together taxonomy terms from flexinodes. Now I would very much like to change the output form tables to a simple list instead. Is there an easy way to do this? I'd be greatful for an answer as I've tried so many ways to do this I'm about to jump out the window of my office... please answer quickly!

<?php
/**
  * Creates a neat table of flexinode titles from a specified term
  * with a link to each one and 'submitted by...' information.
  *
  * $field_id must point to the flexinode field which contains the date.
  * To change which term is listed, simply edit the $term_id string.
  * To change the number of results listed, simply edit the $list_no number.
  *
  * This works with Drupal 4.6 and Drupal 4.7
*/
  $term_id = 2;
  $field_id = 3;
  $list_no = 5;
  $prev_year = '';
  $sql = db_rewrite_sql("SELECT n.nid, n.title, n.created, u.name, fl.numeric_data
          FROM {node} n
            INNER JOIN {users} u ON n.uid = u.uid
            INNER JOIN {term_node} tn ON n.nid = tn.nid
            INNER JOIN {flexinode_data} fl ON n.nid = fl.nid
          WHERE tn.tid = %d AND fl.field_id = %d
          ORDER BY fl.numeric_data DESC");
  $result = pager_query(sprintf($sql, $term_id, $field_id), $list_no);
  while ($anode = db_fetch_object($result)) {
    $year = format_date($anode->numeric_data, 'custom', 'Y');
    $month_day = format_date($anode->numeric_data, 'custom', 'M j Y');
    if ($year != $prev_year) {
      $prev_year = $year;
    }
    $output[$year][] = array(array('data' => $month_day), array('data' => l($anode->title, "node/$anode->nid")));
  }
  foreach ($output as $year => $table) {
    print theme('table', array(array('data' => '<h4>'.$year.'</h4>', 'colspan' => '3')), $table);
  }
  print theme('pager', NULL, $list_no);
?>

Thanx a million!

Comments

Zen’s picture

Project: JSnippets » Flexinode
Version: master » 4.7.x-1.x-dev
Component: Miscellaneous » flexinode.module (core)

This has nothing to do with the snippets _module_. Moving to Flexinode support.

scoutbaker’s picture

Status: Active » Closed (duplicate)