PageScript are kScript that run between the object Html code. It can be an external or embedded script.
External Script: A Script file that will be added to a page layout position.
Embedded Script: Script that contained within the Html Script tag with an engine=kscript attribute.
A sample of page script does the following.
- Find a table named "tablename";
- Query all content out and assign to the variable list.
- The view template loop the data and do the field binding.
<script engine=kscript>
var list = k.database.getTable("tablename").all();
</script>
<div k-foreach="item list">
<h2 k-content="item.title">Welcome!</h2>
<p k-content="item.summary">Welcome to Kooboo CMS</p>
</div>