Созонов Алексей

Веб-разработчик

Theme table Drupal пример

09.08.2015

Создание таблицы в drupal:

$nodes = db_select('node', 'n')->fields('n', array('nid', 'title'))->orderBy('n.nid')->execute();
$header = array('Nid', 'Title');
$rows = array();

foreach ($nodes as $node) {
    $rows[] = array(array('data' => $node->nid, 'class' => 'nid'), array('data' => $node->title, 'class' => 'title'));
}

$output_table = theme('table', array('header' => $header, 'rows' => $rows));
dpm($output_table);

#Drupal