AppML Kasus Prototype
Studi kasus ini menunjukkan bagaimana untuk membangun lengkap <AppML> aplikasi Internet, dengan informasi yang tercantum untuk sejumlah tabel dalam database, mengedit, dan pencarian fungsi.
prototype
Dalam bab ini, kita akan membangun sebuah model prototipe untuk setiap tabel database.
Prototipe mulai dari yang sangat mudah digunakan pengembangan aplikasi.
Model prototipe
Pertama, membuat folder untuk prototipe. folder bernama Prototip.
Kemudian, membuat model prototipe untuk setiap tabel dalam database.
Gunakan SELECT * dari setiap meja, dan menyimpan model sebagai file XML:
Model: Proto_Customers.xml
<datasource>
<database>
<connection>Demo</connection>
<sql>SELECT * FROM Customers</sql>
</database>
</datasource>
</appml>
Model: Proto_Suppliers.xml
<datasource>
<database>
<connection>Demo</connection>
<sql>SELECT * FROM Suppliers</sql>
</database>
</datasource>
</appml>
Model: Proto_Products.xml
<datasource>
<database>
<connection>Demo</connection>
<sql>SELECT * FROM Products</sql>
</database>
</datasource>
</appml>
lihat prototipe
Membuat tampilan prototipe, simpan sebagai Demo_Prototype.html, dan mencobanya:
Views: Demo_Prototype.htm
<div id="List01"></div>
<script src="appml.js"></script>
<script>
customers=new AppML("appml.php","Prototypes/Customers");
customers.run("List01");
</script>
Coba »
Sekarang semua bergabung bersama-sama
Akhirnya, sejumlah kecil kode JavaScript, membuat model prototipe prototipe sederhana untuk semua halaman:
Demo_Prototype_Views.htm
<html>
<head>
<link rel="stylesheet" href="appml.css" />
</head>
<body>
<h1>Demo Applications</h1>
<button onclick='myOpen("Customers")'>Customers</button>
<button onclick='myOpen("Products")'>Products</button>
<button onclick='myOpen("Suppliers")'>Suppliers</button>
<button onclick='myOpen("Shippers")'>Shippers</button>
<button onclick='myOpen("Categories")'>Categories</button>
<button onclick='myOpen("Employees")'>Employees</button>
<button onclick='myOpen("Orders")'>Orders</button>
<button onclick='myOpen("OrderDetails")'>OrderDetails</button>
<br><br>
<div id="Place01"></div>
<script src="appml.js"></script>
<script>
function myOpen(pname)
{
var app_obj
app_obj=new AppML("appml.php","Prototypes/" + pname);
app_obj.run("Place01");
}
</script>
</body>
</html>
Menampilkan hasil »