我正在创建一个drupal表,并查找drupal_theme(),并尝试使用以下代码遵循构建表的规则:
$data = array('value', 'values');
$header = array ($data);
$rows = array(
// Simple row
array(
'Cell 1', 'Cell 2', 'Cell 3'
),
// Row with attributes on the row and some of its cells.
array(
'data' => array('Cell 1', array('data' => 'Cell 2', 'colspan' => 2)),
'class' => 'funky'
)
);
//$output = theme('table', $header, $rows, $attributes = array(),
//$caption = NULL);
$table_t = theme_table($header, $rows, $attributes = array(), $caption = NULL);
//return $output;
return $table_t;但是,该表并不像我预期的那样包含行和列标题。怎么了??
截图:

发布于 2013-02-16 07:00:45
我不确定这是否会有帮助,但这是我在我的一个模块中使用的表头代码。
$header = array(
array('data' => t('One')),
array('data' => t('Two')),
array('data' => t('Three')),
array('data' => t('Four')),
);看看这对你是不是有用。
此外,theme_table($header, $rows, $attributes = array(), $caption = NULL)可以只是theme_table($header, $rows)
https://stackoverflow.com/questions/14904753
复制相似问题