php - 如何在表格底部填充页脚 - 使用 PHP drupal 7
问题描述
我有显示图像并填充图像总目录总查找摘要的功能,总目录和总应解决/总解决
但它显示在页面末尾我想显示在底部我还附上了我的值的屏幕截图,它显示在底部:
这是我的功能:
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 循环上方,它会在表格顶部显示值,但会显示空值。
另请参阅我当前显示底部的屏幕截图,我想在顶部显示:
解决方案
更改$rows
声明:
$header = array(t('Sr no'),t('Image'),t('Public Path'), t('Is Dir'),t('Status'));
$rows = array(0 => 'will be replaced by values');
[...] 最后修改:
$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[0] = $array;
推荐阅读
- graphql - Nest GraphQLDefinitionsFactory 后缀用于类型生成
- amazon-dynamodb - 具有多个条件的 DynamoDB 事务插入(PK/SK attribute_not_exists 和 SK attribute_exists)
- c# - 我该怎么做 Task.FromResult
当我在编译时不知道 T 时(但我确实有对 Type 的引用)? - python - 有没有人能够在 Pygal 中渲染世界地图可视化?
- jquery - 使用 jquery 将 XML 字符串转换为 HTML 表
- nuxt.js - 使用 OneSignal 在 Vercel 上部署 Nuxtjs SSR
- c# - c# Windows Form 慢速渲染对象
- python - sklearn.tree.tree.Tree 中的容量和 node_counts 有什么区别?
- python - 处理年度数据时,如何使条形图中的 xticks 不拥挤
- sql - 如何在 SQL 中的 windows 函数上使用过滤条件