-
Notifications
You must be signed in to change notification settings - Fork 0
/
entity.php
112 lines (111 loc) · 3.92 KB
/
entity.php
1
2
3
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<link rel="stylesheet" href="./css/all.css" />
<script>
<?php
$json = 'data/test.json';
$data = json_decode(file_get_contents($json), true);
$fnum = $data["entity"]["friendly"];
for ($i = 1; $i <= count($fnum); $i++) {
echo "function sfe$i() {
var element = document.getElementById('friendly$i');
window.location = 'pages/entity/friendly/$i.html';
}\n";
}
?>
<?php
$json = 'data/test.json';
$data = json_decode(file_get_contents($json), true);
$nnum = $data["entity"]["neutral"];
for ($i = 1; $i <= count($nnum); $i++) {
echo "function sne$i() {
var element = document.getElementById('neutral$i');
window.location = 'pages/entity/neutral/$i.html';
}\n";
}
?>
<?php
$json = 'data/test.json';
$data = json_decode(file_get_contents($json), true);
$hnum = $data["entity"]["hostile"];
for ($i = 1; $i <= count($hnum); $i++) {
echo "function she$i() {
var element = document.getElementById('hostile$i');
window.location = 'pages/entity/hostile/$i.html';
}\n";
};
?>
</script>
</head>
<body>
<div class="friendly">
<div class="title">
<h3>友好生物</h3>
</div>
<div class="main">
<div class='grid-container'>
<?php
$json = 'data/test.json';
$data = json_decode(file_get_contents($json), true);
for ($i = 1; $i <= count($fnum); $i++) {
$img = $data['entity']['friendly'][$i]['imge'];
$name = $data['entity']['friendly'][$i]['zhname'];
echo "
<div class='grid-item' id='friendly$i' onclick='sfe$i()'>
<img src='$img'>
<p>$name</p>
</div>
";
}
?>
</div>
</div>
</div>
<div class="neutral">
<div class="title">
<h3>中立生物</h3>
</div>
<div class="main">
<div class='grid-container'>
<?php
$json = 'data/test.json';
$data = json_decode(file_get_contents($json), true);
for ($i = 1; $i <= count($nnum); $i++) {
$img = $data['entity']['neutral'][$i]['imge'];
$name = $data['entity']['neutral'][$i]['zhname'];
echo "
<div class='grid-item' id='neutral$i' onclick='sne$i()'>
<img src='$img'>
<p>$name</p>
</div>
";
}
?>
</div>
</div>
<div class="hostile">
<div class="title">
<h3>敌对生物</h3>
</div>
<div class="main">
<div class='grid-container'>
<?php
$json = 'data/test.json';
$data = json_decode(file_get_contents($json), true);
for ($i = 1; $i <= count($hnum); $i++) {
$img = $data['entity']['hostile'][$i]['imge'];
$name = $data['entity']['hostile'][$i]['zhname'];
echo "
<div class='grid-item' id='hostile$i' onclick='she$i()'>
<img src='$img'>
<p>$name</p>
</div>
";
}
?>
</div>
</div>
</div>
</div>
</body>