AppML architecture
MVC architecture
<AppML> adopts the MVC architecture. MVC’s full name is Model View Controller, which is the abbreviation of Model-View-Controller and a software design model. Model Describe your application. View(View) Display your data. Controller Control your application.
Wikipedia:Model, View, Controller
|
Model (MODEL) - Just a simple XML file
A model describes your application and can be repeated across different hardware and software platforms (PC, iPhone, Tablets, etc.) use. It doesn't care about user interface (UI) or presentation.
The model is written in xml and stored in the web server.
<datasource>
<database>
; <connection>Northwind</connection>
; <sql>SELECT CustomerName,ContactName,City,Country FROM Customers</sql>
</database>
</datasource>
<filters>
<query>
<field label="Customer">CustomerName</field>
<field>City</field>
<field>Country</field>
</query>
<order>
<field label="Customer">CustomerName</field>
<field>City</field>
<field>Country</field>
</order>
</filters>
</appml>
The above example defines the data The source is from the Northwind database.
This model allows fetching data using predefined SQL. It also allows data querying and sorting by Customer, City and Country.
View (VIEW) - just an ordinary HTML file
The view is the UI (User Interface: User Interface). It is usually an HTML page that displays and enters data (optional):
<html>
<head>
<link rel="stylesheet" href="appml.css" />
</head>
<body>
<h1>My First Web Application</h1>
< div id="Place01"></div>
<script src="appml.js"></script>
<script>
customers=new
AppML("appml.html","Customers.xml");
customers.run("Place01");
</script>
</body>
< ;/html>
The above HTML page uses the execution script language to create an AppML object and displays the data in the div with id="Place01".
The "appml.js" script file is used.
CONTROLLER (controller) - just a browser or server-side script
Server-side script controls the application in the following ways:
Receive request data from the browser
Return the model and data to the browser
Receive update data from the browser
Update data on the server
During the data communication process, please perform data security verification.
Browser scripts control the application in the following ways:
When the page loads, you can load the <AppML> controller onto the page .
Using controllers, you can create <AppML> objects on the page.
When the <AppML> object is executed, it requests data from the server.
<AppML> object accepts data from the server (using the data model).
<AppML> object (or your code) displays your data on the page.
(Optional) Web users modify data.
(Optional)<AppML> can send modification requests to the server.
Typical Web files and folders:
##web folder: Data Image folder:Images Model folder:Models Application:Demo.htm Style:Demo.css
(or .htmlx) <AppML> Style file: appml.css<AppML> Browser controller: appml.js<AppML> Server Controller: appml.php(or .htmlx) |