<!DOCTYPE html>
<html>
<head>
<title>Template html5 + Bootstrap 3 Styles</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<style>
h1 {font-size:18px;}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h1>Template html5 + Bootstrap 3 Styles</h1>
<p>The content of the document......</p>
<p>See Docs here <a href="http://bootstrap-3.ru/css.php" target="_blank">http://bootstrap-3.ru/css.php</a></p>
<?
$TEST_ARR = array(
array("ID"=>0,"NAME"=>"Vasya","TEXT"=>"Boss"),
array("ID"=>2,"NAME"=>"Petya","TEXT"=>"Worker"),
array("ID"=>3,"NAME"=>"Shura","TEXT"=>"Manager"),
array("ID"=>4,"NAME"=>"Kusya","TEXT"=>"HR")
);
echo getTable($TEST_ARR);
?>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
</body>
</html>
<?
// Возвращает html таблицу (стили для bootstrap)
function getTable($data) {
$str_table = "";
$str_table .= "<table class='table_distances table table-striped table-bordered'>";
$str_table .= "<tr>";
foreach($data[0] as $key=>$val) { $str_table .= "<th>".$key."</th>"; }
$str_table .= "</tr>";
foreach($data as $item){
$str_table .= "<tr>";
foreach($item as $key=>$value){
if(is_array($value)){
$str_table .= "<td>".GetTable($value)."</td>";
} else {
$str_table .= "<td>".$value."</td>";
}
}
$str_table .= "</tr>";
}
$str_table .= "</table>";
return $str_table;
}
?>