TOP ▲
itcore TOP プログラムパーツ
uHtmlHeader 共通のHTMLヘッダ | itcore 2018年
PHP
関数
<?php
// 共通のHTMLヘッダ
function uHtmlHeader($title) {
$doc_root = $_SERVER['DOCUMENT_ROOT'];
$data =<<<EOT
<!DOCTYPE html><html lang="ja">
<head>
<meta charset="utf-8">
<title>$title</title>
<link rel="shortcut icon" href="$doc_root/favicon.ico">
<style type="text/css">
a:hover {background-color: lightpink;} /* リンクの背景色を変える */
h1 {background: limegreen;}
h2 {background: aquamarine;}
h3 {background: pink;}
h4 {background: gold;}
//img {border: dimgray solid 1px; max-width:100%; height:auto;}
//.msg {color:darkgreen;} /* メッセージ */
/* tbl01 テーブル thに背景(緑) */
.tbl01 {border-collapse: collapse;margin:6px; }
.tbl01 th{padding: 6px;border: 1px solid maroon; font-size:medium; background-color:yellowgreen;}
.tbl01 td{padding: 6px;border: 1px solid maroon;}
/* tbl02 データ内テーブル thに背景(灰色) 枠線グレー */
.tbl02 {border-collapse: collapse;margin:6px; }
.tbl02 th{padding: 6px;border: 1px solid dimgray; font-size:medium; background-color:lightgray;}
.tbl02 td{padding: 6px;border: 1px solid dimgray;}
/* tbl03 データ内テーブル 枠なし 背景なし*/
.tbl03 {border-collapse: collapse;margin:6px; }
.tbl03 th{padding: 6px;border: 0px; background-color:white; text-align:left;}
.tbl03 td{padding: 6px;border: 0px;}
</style>
</head>
<body>
EOT;
return $data;
}
?>
テスト
<?php include "uHtmlHeader.func"; ?>
<?php
$title = "テスト画面";
print uHtmlHeader($title);
print "$title<br>
<table class=tbl01>
<tr><th>項目<td>データ
</table>
";
print(uJsClose()); // 閉じるボタン
//-------------------------
function uJsClose() {
return "<input type=button value=\"閉じる\" onClick=\"window.open('about:blank', '_self').close();\">\n";
}
?>
実行