table.php 730 Bytes
Newer Older
Qiang Xue committed
1 2
<?php
use yii\helpers\Html;
3
use yii\helpers\VarDumper;
Qiang Xue committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

/**
 * @var string $caption
 * @var array $values
 */
?>
<h3><?= $caption ?></h3>

<?php if (empty($values)): ?>

	<p>Empty.</p>

<?php else:	?>

	<table class="table table-condensed table-bordered table-striped table-hover" style="table-layout: fixed;">
		<thead>
			<tr>
				<th style="width: 200px;">Name</th>
				<th>Value</th>
			</tr>
		</thead>
		<tbody>
		<?php foreach($values as $name => $value): ?>
			<tr>
				<th style="width: 200px;"><?= Html::encode($name) ?></th>
29
				<td><?= htmlspecialchars(VarDumper::dumpAsString($value), ENT_QUOTES|ENT_SUBSTITUTE, \Yii::$app->charset, true) ?></td>
Qiang Xue committed
30 31 32 33 34 35
			</tr>
		<?php endforeach; ?>
		</tbody>
	</table>

<?php endif; ?>