【发布时间】:2020-06-17 01:48:54
【问题描述】:
我有显示图像和填充图像总目录总查找摘要的功能,总目录和总应解决/总解决
但它显示在页面末尾我想显示在底部我还附上了显示在底部的值的屏幕截图:
这是我的功能:
function _network_drive_test(){
$arguments = arg();
$id = $arguments[count($arguments) - 2];
$query = db_select('network_drive_listing','n');
$query
->fields('n')
->condition('n.network_drive_id',$id)
->orderBy('n.ndlistid');
$results = $query->execute();
$header = array(t('Sr no'),t('Image'),t('Public Path'), t('Is Dir'),t('Status'));
$rows = array();
$totalFind = 0;
$totalShouldFind = 0;
$totalIsDir = 0;
$totalResolved = 0;
$forOfor = 0;
foreach($results as $record) {
$totalFind++;
$array = [
$totalFind,
$record->public_path !== "" ? '<div style="background-image: url(\'' . url($record->public_path) . '\'); height: 50px; width:50px;background-size: cover;border-radius: 50%;background-position: center;" />' : '',
$record->public_path,
$record->is_dir
];
if ($record->is_dir != 1) {
$totalShouldFind++;
$headers = @get_headers($record->public_path);
// Use condition to check the existence of URL
if ($headers && strpos($headers[0], '200')) {
$array['status'] = "URL Exist" . PHP_EOL;
$totalResolved++;
} else {
$array['status'] = "URL Doesn't Exist(" . $record->public_path . ")" . PHP_EOL;
$forOfor++;
}
} else {
$totalIsDir++;
$array['status'] = "This is directory" . PHP_EOL;
}
$rows[] = $array;
}
$array = [
$form['#prefix'] = '<div class="page_summary" <strong>Summary: </strong>',
$form['#prefix'] = '<div class="total_find" <strong>Total Find: </strong>'. $totalFind,
$form['#prefix'] = '<div class="total_dir" <strong>Total Find: </strong>'. $totalIsDir,
$form['#prefix'] = '<div class="total_should_resolve" <strong>Total Should Resolve</strong>: ' . $totalShouldFind.'<strong> / Total Resolved : </strong>'. $totalResolved,
$form['#prefix'] = '<div class="error_bar" style="display">404:'.$forOfor,
];
$rows[] = $array;
return theme('table', array('header' => $header, 'rows' => $rows));
}
如果我将 $form 值放在 foreach 循环上方,它会在表格顶部显示值,但会显示空值。
另请参阅我当前显示底部的屏幕截图,我想将其显示在顶部:
【问题讨论】:
标签: php foreach drupal-7 footer