AppML HTML รวม


ด้วย AppML คุณสามารถรวม HTML ใน HTML ได้


รวม HTML ใน HTML

ตัวอย่างที่ดีของเรื่องนี้คือการรวมส่วนท้าย HTML มาตรฐานไว้ในหน้า HTML ทั้งหมดของคุณ

นี่คือตัวอย่างของไฟล์ที่มีส่วนท้ายมาตรฐาน:

inc_footer.htm

<hr style="margin-top:10px;">
<p style="font-size:11px">2016&copy; W3Schools. All rights reserved.</p>
<hr>

ในตัวอย่างนี้ แอตทริบิวต์ appml-include-html ใช้เพื่อรวมไฟล์ "inc_footer.htm":

ตัวอย่าง

<!DOCTYPE html>
<html lang="en-US">

<title>Customers</title>
<link rel="stylesheet" href="style.css">
<script src="https://www.w3schools.com/appml/2.0.3/appml.js"></script>

<body>

<h1>Customers</h1>
<table appml-data="customers.js">
<tr>
  <th>Customer</th>
  <th>City</th>
  <th>Country</th>
</tr>
<tr appml-repeat="records">
  <td>{{CustomerName}}</td>
  <td>{{City}}</td>
  <td>{{Country}}</td>
</tr>
</table>

<div appml-include-html="inc_footer.htm"></div>

</body>
</html>