Тема_разработка drupal

Обновить

Я сделал эту таблицу: у меня есть 2 массива UGentArray и InternshipsArray. Как я могу установить их в своей таблице? вместо «Данные столбца столбца 1» и «Данные столбца« Строка 2 ». Мой вопрос: я хочу, чтобы значения из UgentArray и InternshipArray составляли 2 столбца под каждым заголовком UGentID и стажировки

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] 

введите описание изображения здесь

Без примера данных, с которых вы начинаете, сложно дать вам точный код для решения вашей проблемы.

В общем, лучший способ создания таблиц в Drupal выглядит так:

 $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); 

Как я уже сказал, не зная, что находится в $studentUGentID и $internships $studentUGentID я не могу помочь дальше.

С образцовыми данными я мог бы помочь вам больше.