File: /var/www/doco2/wp-content/themes/ormedia/page-alert-detail.php
<?php
/* Template Name: Alert Detail */
require_once('key_alert_functions.php');
$id = $_REQUEST['id'];
if (empty($id) || !is_numeric($id) || $id < 1) {
die("id不合法");
}
$item = get_alert_by_id($id);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>KeyAlert</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
.red {
color: #903939;
}
.bold {
font-weight: bold;
}
.alert-back {
font-size: 120%;
font-weight: bold;
cursor: pointer;
display: block;
margin-bottom: 16px;
}
.alert-back i {
margin-right: 10px;
}
.alert-title {
color: #903939;
text-align: center;
}
.alert-content {
max-width: 800px;
margin: 0 auto;
}
.alert-item {
padding: 16px;
display: block;
text-decoration: none;
}
.alert-item-title {
font-size: 120%;
}
.alert-item-time {
color: #666;
margin-top: 10px;
}
.alert-item-desc{
margin-top: 16px;
}
</style>
</head>
<body>
<div class="alert-content">
<h2 class="alert-title">KeyAlert</h2>
<div class="alert-item w3-card w3-margin w3-hover-shadow">
<a class="alert-back" onclick="javascript:history.back()"><i class="fa fa-arrow-left"></i>返回</a>
<?php
echo sprintf('
<div class="alert-item-title">%s</div>
<div class="alert-item-time">%s</div>
<div class="alert-item-desc">%s</div>
', $item->title, $item->creation_time, $item->content);
?>
</div>
</div>
</body>
</html>