AppML кейс - JSON файлы
HTML страница
Это HTML ресурс:
<<!DOCTYPE html>
<html lang="ru">
<link rel="stylesheet" href="../w3css/4/w3.css">
<script src="2.0.3/appml.js"></script>
<body>
<div class="w3-container" appml-data="https://www.w3schools.com/appml/appml.php?model=model_cd_from_json">
<h1>CD Коллекция</h1>
<h3>Извлечено из текстового файла JSON</h3>
<div appml-include-html="inc_listcommands_nofilter.html"></div>
<table
class="w3-table-all">
<tr>
<th>Title</th>
<th>Artist</th>
<th>Price</th>
</tr>
<tr appml-repeat="records">
<td>{{Title}}</td>
<td>{{Artist}}</td>
<td>{{Price}}</td>
</tr>
</table>
</div>
</body>
</html>
PHP »
.NET »
Модель
Это модель, используемая в приложении:
Модель
{
"rowsperpage" : 7,
"data" : {
"type" : "jsonfile",
"filename" : "cd_catalog.js",
"record" : "cd",
"items"
: [
{"name" : "Title", "nodename" : "title"},
{"name"
: "Artist", "nodename" : "artist"},
{"name" : "Price",
"nodename" : "price"}
]
}
}
Файл
Это JSON файл:
cd_catalog.js
{
"cd" : [
{ "title" : "Empire Burlesque", "artist" : "Bob Dylan",
"price" : "10.90" },
{ "title" : "Hide your heart", "artist" :
"Bonnie Tyler", "price" : "9.90" },
{ "title" : "Greatest Hits",
"artist" : "Dolly Parton", "price" : "9.90" },
{ "title" : "Still got
the blues", "artist" : "Bob Dylan", "price" : "10.20" },
{ "title" :
"Eros", "artist" : "Eros Ramazzotti", "price" : "9.90" },
{ "title" :
"One night only", "artist" : "Bee Gees", "price" : "10.90" },
{
"title" : "Sylvias Mother", "artist" : "Dr.Hook", "price" : "8.10" },
{ "title" : "Maggie May", "artist" : "Rod Stewart", "price" : "8.50" },
{ "title" : "Empire Burlesque", "artist" : "Bob Dylan", "price" :
"10.90" },
{ "title" : "Hide your heart", "artist" : "Bonnie Tyler",
"price" : "9.90" },
{ "title" : "Greatest Hits", "artist" : "Dolly
Parton", "price" : "9.90" },
{ "title" : "Still got the blues",
"artist" : "Bob Dylan", "price" : "10.20" },
{ "title" : "Eros",
"artist" : "Eros Ramazzotti", "price" : "9.90" },
{ "title" : "One
night only", "artist" : "Bee Gees", "price" : "10.90" },
{ "title" :
"Sylvias Mother", "artist" : "Dr.Hook", "price" : "8.10" },
{ "title"
: "Maggie May", "artist" : "Rod Stewart", "price" : "8.50" },
{
"title" : "Empire Burlesque", "artist" : "Bob Dylan", "price" : "10.90"
},
{ "title" : "Hide your heart", "artist" : "Bonnie Tyler", "price"
: "9.90" },
{ "title" : "Greatest Hits", "artist" : "Dolly Parton",
"price" : "9.90" },
{ "title" : "Still got the blues", "artist" :
"Bob Dylan", "price" : "10.20" },
{ "title" : "Eros", "artist" :
"Eros Ramazzotti", "price" : "9.90" },
{ "title" : "One night only",
"artist" : "Bee Gees", "price" : "10.90" },
{ "title" : "Sylvias
Mother", "artist" : "Dr.Hook", "price" : "8.10" },
{ "title" :
"Maggie May", "artist" : "Rod Stewart", "price" : "8.50" },
{ "title"
: "Empire Burlesque", "artist" : "Bob Dylan", "price" : "10.90" },
{
"title" : "Hide your heart", "artist" : "Bonnie Tyler", "price" : "9.90"
},
{ "title" : "Greatest Hits", "artist" : "Dolly Parton", "price" :
"9.90" },
{ "title" : "Still got the blues", "artist" : "Bob Dylan",
"price" : "10.20" },
{ "title" : "Eros", "artist" : "Eros
Ramazzotti", "price" : "9.90" },
{ "title" : "One night only",
"artist" : "Bee Gees", "price" : "10.90" },
{ "title" : "Sylvias
Mother", "artist" : "Dr.Hook", "price" : "8.10" },
{ "title" :
"Maggie May", "artist" : "Rod Stewart", "price" : "8.50" },
{ "title"
: "Empire Burlesque", "artist" : "Bob Dylan", "price" : "10.90" },
{
"title" : "Hide your heart", "artist" : "Bonnie Tyler", "price" : "9.90"
},
{ "title" : "Greatest Hits", "artist" : "Dolly Parton", "price" :
"9.90" },
{ "title" : "Still got the blues", "artist" : "Bob Dylan",
"price" : "10.20" },
{ "title" : "Eros", "artist" : "Eros
Ramazzotti", "price" : "9.90" },
{ "title" : "One night only",
"artist" : "Bee Gees", "price" : "10.90" },
{ "title" : "Sylvias
Mother", "artist" : "Dr.Hook", "price" : "8.10" },
{ "title" :
"Maggie May", "artist" : "Rod Stewart", "price" : "8.50" }
]
}