Iam使用表主題。下面看到的是我創建一個表來顯示行和列中的值的完整代碼。該代碼還包含我的主題註冊。值來自代碼中看到的6個數組,即fileId,fileName等。現在使用此代碼,我得到這個輸出http://www.image-share.com/ijpg-1166-290.html。 我的願望輸出必須看起來像這樣http://www.image-share.com/ijpg-1166-289.html。該數組正在填充正確,因爲我打印出來的值成功,在這裏看到http://www.image-share.com/ijpg-1166-288.html我不需要複選框,但我用這個代碼,因爲我從我之前使用的一個例子跟着它。如何主題Drupal 6表以輸出行和列的數組?
你能指導我哪裏錯誤的地方,我得到這個奇怪的輸出。
function freeway_dashboard_details(){
$pidobtained = $_GET['project_id'] ;
$fileId = array();
$fileName = array();
$srcLang = array();
$targLang = array();
$statusId = array();
$statusDesc = array();
$LoginClient = new SoapClient("https://freeway.demo.company.com/vojo/FreewayAuth.asmx?wsdl", array("trace"=>1));
$ServicesLink = new SoapClient("https://freeway.demo.company.com/vojo/Service.asmx?wsdl", array("trace"=>1));
try
{
$arrResponse = $LoginClient->Logon(array ('Username'=>'','Password'=>''));
$ticket = ($arrResponse->LogonResult);
$fileStatus = $ServicesLink->GetFileStatus(array('Ticket'=>$ticket,'ProjectID'=>$pidobtained,'SourceLanguageID'=> "", 'TargetLanguageID'=> "",'FileID'=> "",'Filename'=>""));
$arrayPid = array();
foreach($fileStatus->GetFileStatusResult->FileStatuses->FileStatus as $fileStatusObtained)
{
$arrayPid = get_object_vars($fileStatusObtained);
//print_r($fileStatusObtained->FileID);
$fileId [] = $fileStatusObtained->FileID;
$fileName[] = $fileStatusObtained->Filename;
$srcLang[] = $fileStatusObtained->SourceLanguageID;
$targLang[] = $fileStatusObtained->TargetLanguageID;
$statusId[] = $fileStatusObtained->StatusID;
$statusDesc[] = $fileStatusObtained->StatusDescription;
}
for($n=0;$n <count($fileId);$n+=1){
$options[$fileId[$n]] = '';
$form[$fileId[$n]]['FileID'] = array('#value' => $fileId[$n]);
$form[$fileName[$n]]['FileName'] = array('#value' => $fileName[$n]);
$form[$srcLang[$n]]['SrcLang'] = array('#value' => $srcLang[$n]);
$form[$targLang[$n]]['TarLang'] = array('#value' => $targLang[$n]);
$form[$statusId[$n]]['StatusID'] = array('#value' => $statusId[$n]);
$form[$statusDesc[$n]]['StatusDesc'] = array('#value' => $statusDesc[$n]);
}
}
catch(SoapFault $exception)
{
return $exception;
}
$form['featured'] = array(
'#type' => 'checkboxes',
'#options' => $options,
'#multiple' => false,
);
return $form;
}
function freeway_theme() {
return array('freeway_dashboard' => array('arguments' => array('form' => NULL),),'freeway_dashboard_details' => array('arguments' => array('form' => NULL),),);
}
function theme_freeway_dashboard_details($form) {
$rows = array();
foreach (element_children($form) as $key) {
$row = array();
if (isset($form[$key]['FileID'])) {
$status = drupal_render($form['featured'][$key]);
$row[] = array('data' => $status, 'class' => 'checkbox');
$row[] = ''. drupal_render($form[$key]['FileID']) .'';
$row[] = array('data' => drupal_render($form[$key]['FileName']));
$row[] = array('data' => drupal_render($form[$key]['SrcLang']));
$row[] = array('data' => drupal_render($form[$key]['TarLang']));
$row[] = array('data' => drupal_render($form[$key]['StatusID']));
$rows[] = $row;
}
}
$header = array();
$header[] = array('data' => t('Featured'), 'class' => 'checkbox');
$header[] = t('File ID');
$header[] = t('File Name');
$header[] = t('Source Language');
$header[] = t('Target Language');
$header[] = t('Status ID');
$header[] = t('Status Description');
$output = theme('table', $header, $rows,array('size'=>10, 'class' => 'table_class'));
$output .= drupal_render($form);
return $output;
}
感謝 安吉拉