Skip to content

Instantly share code, notes, and snippets.

@johnrobertwilson
Created September 13, 2011 23:32
Show Gist options
  • Save johnrobertwilson/1215479 to your computer and use it in GitHub Desktop.
Save johnrobertwilson/1215479 to your computer and use it in GitHub Desktop.
Easy Drupal 7 Tables output
$data = array(0 => 'data1', 1 => 'data2', 2 => 'data3');
$data_table = array(
'#theme' => 'table',
'#header' => array(t('data index'), t('data value')),
'#empty' => t('You have no content channels for this account.'),
'#rows' => array(),
);
if(!empty($data)){
foreach($data as $data_item_index => $data_item){
$content_channels_table['#rows'][] = array($data_item_index, $data_item[$data_item_index]);
}
}
render($data_table);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment