theme_table drupal开发 [英] theme_table drupal development

查看:101
本文介绍了theme_table drupal开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新



我做了这个表:我有2个数组的UGentArray和InternshipsArray。我如何在桌子上设置这些?而不是行列1数据和行列2数据。我的问题是:我希望UgentArray和InternshipArray中的值为每个标题下的2列UGentID和实习

 在此输入代码//在桌面上进行显示和显示。 
$ tbl_header = array();
$ tbl_header [] = array(data=>UGentID);
$ tbl_header [] = array(data=>实习);
$ tbl_row = array();
foreach($ studentUGentID as $ key => $ value){
for($ i = 0; $ i< count($ value); $ i ++){
$ tbl_row [] = $ value [$ i] ['value'];
}
}
$ tbl_row [] =行列2数据;
$ tbl_rows = array();
$ tbl_rows [] = $ tbl_row;
$ html = theme_table($ tbl_header,$ tbl_rows);
return $ html;![输入图像描述] [1]

解决方案

p>没有一个你开始的数据的例子很难给你确切的代码来解决你的问题。



一般来说,最好的方式来建立表格Drupal是这样的:

  
$ table_headers = array(
t('UGentID'),//这是第一列的标题
t('Internships'),//这是第二列的标题
);
$ table_rows = array()
foreach($ studentUGentID as $ key => $ value){
$ table_rows [] = array(
'column 1 data',//添加行一列
'列2数据',//一次
)的所有数据;
}
$ html = theme('table',$ table_headers,$ table_rows);

正如我所说,不知道什么是 $ studentUGentID $实习我无法进一步帮助。



使用示例数据,我可以帮助您更多。 >

update

I have made this table: I have 2 array's UGentArray and InternshipsArray. How can I set these in my table? instead of "Row column 1 data" and "Row column 2 data". My question is: I want the values from UgentArray and InternshipArray as 2 columns under Each title UGentID and Internships

enter code here// Make table and display on screen.
$tbl_header = array();
$tbl_header[] = array("data" => "UGentID");
$tbl_header[] = array("data" => "Internships");
$tbl_row = array();    
foreach($studentUGentID as $key => $value) {
    for($i = 0; $i<count($value); $i++) {
        $tbl_row[] = $value[$i]['value'];
    }
}
$tbl_row[] = "Row column 2 data";
$tbl_rows = array();
$tbl_rows[] = $tbl_row;    
$html = theme_table($tbl_header,$tbl_rows);
return $html;![enter image description here][1]

解决方案

Without having an example of the data you are starting with it is difficult to give you exact code to solve your problem.

In general the best way to built tables in Drupal is like this:


$table_headers = array(
  t('UGentID'), // this is the header for the first column
  t('Internships'), // this is the header for the second column
);
$table_rows = array()
foreach ($studentUGentID as $key => $value) {
  $table_rows[] = array(
    'column 1 data', // add all the data for the row one column
    'column 2 data', // at a time
  );
}
$html = theme('table', $table_headers, $table_rows);

As I said without knowing what is in $studentUGentID and $internships I cannot help further.

With sample data I could help you more.

这篇关于theme_table drupal开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆