Return to Snippet

Revision: 864
at August 16, 2006 10:31 by weitzman


Initial Code
\$sql = "$1";
\$header = array(
  array('data' => t('$2'), 'field' => '$3', 'sort' => '${4:asc}'),
  array('data' => t('$5'), 'field' => '$6'),
  array('data' => t('$7'), 'colspan' => '2')
);
\$sql .= tablesort_sql(\$header);
\$result = pager_query(\$sql, 50);

\$destination = drupal_get_destination();
while (\$row = db_fetch_object(\$result)) {
  $rows[] = array(\$row->, \$row->, array(), \$destination));
}

if (\$pager = theme('pager', NULL, 50, 0, tablesort_pager())) {
  \$rows[] = array(array('data' => \$pager, 'colspan' => '2'));
}

if (!\$rows) {
  \$rows[] = array(array('data' => t('$8'), 'colspan' => '2'));
}

return theme('table', \$header, \$rows);

Initial URL


Initial Description


Initial Title
query and iterate

Initial Tags
textmate, drupal

Initial Language
PHP