<AppML> Fallstudie – Prototyp


Diese Fallstudie zeigt, wie man eine vollständige <AppML>-Internet-Anwendung mit der Fähigkeit zum Auflisten, Bearbeiten und Durchsuchen von Informationen für mehrere Tabellen in einer Datenbank erstellt.


Prototyp

In diesem Kapitel erstellen wir ein Prototypmodell für jede Tabelle in der Datenbank.

Prototypen sind ein sehr praktischer Ausgangspunkt für die Entwicklung von Anwendungen.


Prototypmodelle

Erstellen Sie zuerst einen Ordner für die Prototypen. Nennen Sie diesen Ordner Prototypes.

Erstellen Sie dann für jede Tabelle in der Datenbank ein Prototypmodell.

Verwenden Sie SELECT * aus jeder Tabelle und speichern Sie die Modelle als XML-Dateien:

Modell: Proto_Customers.xml

<appml>
<datasource>
<database>
<connection>Demo</connection>
<sql>SELECT * FROM Customers</sql>
</database>
</datasource>
</appml>

Modell: Proto_Suppliers.xml

<appml>
<datasource>
<database>
<connection>Demo</connection>
<sql>SELECT * FROM Suppliers</sql>
</database>
</datasource>
</appml>

Modell: Proto_Products.xml

<appml>
<datasource>
<database>
<connection>Demo</connection>
<sql>SELECT * FROM Products</sql>
</database>
</datasource>
</appml>



Prototyp-Ansicht

Erstellen Sie eine Prototyp-Ansicht, speichern Sie sie als Demo_Prototype.html und probieren Sie sie aus:

Ansicht: Demo_Prototype.htm

<h1>Kunden</h1>
<div id="List01"></div>

<script src="appml.js.html"></script>
<script>
customers=new AppML("appml.php","Prototypes/Customers");
customers.run("List01");
</script>

Ausprobieren »


Kombinieren Sie nun alles miteinander

Erstellen Sie schließlich mit ein wenig JavaScript-Code eine einfache Prototyp-Seite für alle Prototypmodelle:

Demo_Prototype_Views.htm

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="appml.css.html" />
</head>

<body>
<h1>Demo-Anwendungen</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.html"></script>
<script>
function myOpen(pname)
{
var app_obj
app_obj=new AppML("appml.php","Prototypes/" + pname);
app_obj.run("Place01");
}
</script>

</body>
</html>

Ergebnisse anzeigen »


Andere Erweiterungen