AppML- gegevens


Het belangrijkste doel van AppML is het verstrekken van gegevens aan HTML-pagina's.


AppML verbinden met gegevens

  • AppML kan gegevens van variabelen weergeven
  • AppML kan gegevens uit bestanden weergeven
  • AppML kan gegevens uit databases weergeven

AppML met een JavaScript-object

Een gebruikelijke manier om HTML en gegevens te scheiden, is door de gegevens op te slaan in een JavaScript-object.

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 met een JSON-bestand

Een andere veelgebruikte manier om HTML en gegevens te scheiden, is door de gegevens op te slaan in een JSON-bestand:

klanten.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 kunt u een JSON-bestand specificeren als de gegevensbron in het appml-data-attribuut:

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 een database

Met een beetje hulp van een webserver kunt u uw applicatie voeden met SQL-gegevens.

In dit voorbeeld wordt PHP gebruikt om gegevens uit een MySQL-database te lezen:

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>

De kracht van AppML

U staat op het punt de kracht van AppML te ontdekken.

AppML kan u voorzien van gegevens, controllers en modellen voor:

  • Supereenvoudige HTML-toepassingsontwikkeling
  • Supereenvoudige modellering, prototyping en testen

U kunt zoveel AppML-toepassingen binnen een HTML-pagina plaatsen als u wilt.

AppML interfereert niet met andere delen van de pagina.

Je hebt volledige HTML-, CSS- en JavaScript-vrijheid.

AppML kan worden gebruikt om volledige CRUD-webapplicaties te ontwikkelen.

CRUD: maken , lezen , bijwerken , verwijderen .

 Om de kracht van AppML te ontdekken: Bekijk een AppML-demo .