Created
November 19, 2015 16:51
-
-
Save apperceive/074cad7de7bb476ce4cd to your computer and use it in GitHub Desktop.
Simple Drupal theme_table example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$colb = array( | |
'data' => 'b', | |
'header' => false, // cell is a header | |
'class' => 'bclass bclass', | |
'any-td-attr' => 'bvalue', | |
); | |
$cella2 = array( | |
'data' => 'a2', | |
//'header' => false, // cell is a header | |
'class' => 'aclass aaclass', | |
'any-td-attr' => 'avalue', | |
); | |
$cols = array('a', $colb, 'c'); | |
$data = array( | |
array('a1', 'b1', 'c1'), | |
array($cella2, 'b2', 'c2'), | |
array('a3', 'b3', 'c3'), | |
array('a4', 'b4', 'c4'), | |
); | |
$vars = array( | |
'header' => $cols, | |
'rows' => $data, | |
'attributes' => array(), | |
'caption' => 'caption goes here', | |
'colgroups' => array(), | |
'sticky' => true, | |
'empty' => 'no data dada', | |
); | |
drupal_set_message(theme_table($vars)); | |
print theme_table($vars); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
goal style cell, test heading