AppML- data
Die hoofdoel van AppML is om data aan HTML-bladsye te verskaf.
Koppel AppML aan data
- AppML kan data van veranderlikes vertoon
- AppML kan data vanaf lêers vertoon
- AppML kan data vanaf databasisse vertoon
AppML Met behulp van 'n JavaScript-objek
'n Algemene manier om HTML en Data te skei, is om die data in 'n JavaScript-objek te stoor.
Voorbeeld
<table appml-data="dataObj">
<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>
<script>
var dataObj = {
"records":[
{"CustomerName":"Alfreds Futterkiste","City":"Berlin","Country":"Germany"},
{"CustomerName":"Ana Trujillo Emparedados y helados","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Antonio Moreno Taquería","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Around the Horn","City":"London","Country":"UK"},
{"CustomerName":"B's
Beverages","City":"London","Country":"UK"},
{"CustomerName":"Berglunds
snabbköp","City":"Luleå","Country":"Sweden"},
{"CustomerName":"Blauer See
Delikatessen","City":"Mannheim","Country":"Germany"},
{"CustomerName":"Blondel
père et fils","City":"Strasbourg","Country":"France"},
{"CustomerName":"Bólido
Comidas preparadas","City":"Madrid","Country":"Spain"},
{"CustomerName":"Bon
app'","City":"Marseille","Country":"France"},
{"CustomerName":"Bottom-Dollar
Marketse","City":"Tsawassen","Country":"Canada"},
{"CustomerName":"Cactus
Comidas para llevar","City":"Buenos Aires","Country":"Argentina"},
{"CustomerName":"Centro
comercial Moctezuma","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Chop-suey Chinese","City":"Bern","Country":"Switzerland"},
{"CustomerName":"Comércio Mineiro","City":"São Paulo","Country":"Brazil"}
]};
</script>
AppML Gebruik 'n JSON-lêer
Nog 'n algemene manier om HTML en data te skei, is om die data in 'n JSON-lêer te stoor:
kliënte.js
{
"records":[
{"CustomerName":"Alfreds Futterkiste","City":"Berlin","Country":"Germany"},
{"CustomerName":"Ana Trujillo Emparedados y helados","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Antonio Moreno Taquería","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Around the Horn","City":"London","Country":"UK"},
{"CustomerName":"B's Beverages","City":"London","Country":"UK"},
{"CustomerName":"Berglunds
snabbköp","City":"Luleå","Country":"Sweden"},
{"CustomerName":"Blauer See
Delikatessen","City":"Mannheim","Country":"Germany"},
{"CustomerName":"Blondel
père et fils","City":"Strasbourg","Country":"France"},
{"CustomerName":"Bólido
Comidas preparadas","City":"Madrid","Country":"Spain"},
{"CustomerName":"Bon
app'","City":"Marseille","Country":"France"},
{"CustomerName":"Bottom-Dollar
Marketse","City":"Tsawassen","Country":"Canada"},
{"CustomerName":"Cactus
Comidas para llevar","City":"Buenos Aires","Country":"Argentina"},
{"CustomerName":"Centro
comercial Moctezuma","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Chop-suey Chinese","City":"Bern","Country":"Switzerland"},
{"CustomerName":"Comércio Mineiro","City":"São Paulo","Country":"Brazil"}
]
}
Met AppML kan jy 'n JSON-lêer as die databron in die appml-data-kenmerk spesifiseer:
Voorbeeld
<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>
AppML met behulp van 'n databasis
Met 'n bietjie hulp van 'n webbediener kan jy jou toepassing met SQL-data voed.
Hierdie voorbeeld gebruik PHP om data van 'n MySQL-databasis te lees:
Voorbeeld
<table appml-data="https://www.w3schools.com/appml/customers.php">
<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>
Die krag van AppML
Jy is op die punt om die krag van AppML te ontdek.
AppML kan jou van data, beheerders en modelle voorsien vir:
- Super-maklike HTML-toepassingsontwikkeling
- Super-maklike modellering, prototipering en toetsing
Jy kan soveel AppML-toepassings as wat jy wil binne 'n HTML-bladsy plaas.
AppML meng nie in met ander dele van die bladsy nie.
Jy het volle HTML-, CSS- en JavaScript-vryheid.
AppML kan gebruik word om volskaalse CRUD-webtoepassings te ontwikkel.
CRUD: Skep , lees , werk op , verwyder .
Om die krag van AppML te ontdek: Bekyk 'n AppML-demo .