Are you logged in? Yes, so you see the control elements, New, Edit and Delete. With New you can create a new record. With Edit you get directly a form to change your record. With Delete you get immideately rid of your record.
Connect a catalog element to your table and get automatically a a catalog with form and detail page (Catalog on the fly)!
With "get_datadefinition.php" you can can create a datadefinition, which contains the declaration for:
- data access class
- form
- tabulator (formatting of the columns)
- HTML for the catalog,
your individual columns need to be placed there manually
Change the data definition according to your wishes. Add your table columns manually as placeholder to your catalog layout. You can easily add or remove an image upload. Textareas can be enriched with tinymce for a better editing and formatting.
Templates
catalog Standard

filename: masterdata/templates/catalog_*.html
- page-layout
- headline with search
- control elements by logged in user
- 1 columns
- pagination
- post
- image with picture box
- title with link
- all table columns in table
catalog-4tiles

filename: masterdata/templates/template-catalog-4tiles_*.html:
- page-layout
- headline with search
- control elements by logged in user
- 4 columns
- pagination
- post
- image with aspect ration: 3/2
- title with link
- table with 6 rows
catalog-news

filename: masterdata/templates/catalog-news_*.html
- page-layout
- headline without search
- control elements by logged in user
- 1 columns
- pagination
- post
- image to text in a 50/50 ratio
- image with original size
- title with link
- date time created with username
- description tedt
Developer
Table requirement: primary key of the table
A table for master data has to fullfill the following rules:
- the Primary key has to consist of a single field
- INT, autoincrement
- creatorID (by using the data access rights )
- INT
The primary key is a hidden field in the master data form. It can not be changed!
Open datadefinition as page
you can open the datadefintion as:
Catalog on the fly
Checkout the generation of a catalog on the fly:
- Customer table on the fly:
index.php?page=catalog&table=er_customer&headtitlecolumn=name1&headdescriptioncolumn=city - Item table on the fly:
index.php?table=k8components&page=catalog&headtitlecolumn=text1&headdescriptioncolumn=textdimensions
Attention, generate a table is only allowed on this demonstration page. This functionality is normally turned off!
Create a datadefinition out of your table
The datadefinition contains details for reading, saving and displaying a recordset.
The following steps are necessary to create your own datadefinition:
- er_customer, if not exist create it with "k8examples.sql"
- generate your datadefinition
- table: er_customer
- datadefID: catalogcustomer
- get_datadefinition.php?datadefID=catalogcustomer&table=er_customer &headtitlecolumn=name1 &headdescriptioncolumn=city
if you use copy and paste, please remove the spaces!"
- folder <myproject> create a folder: catalogcustomer
- save the datadefinition in your folder catalogcustomer with the name "catalogcustomer" as json file.
- look in your browser:
index.php?datadefID=catalogcustomer&page=masterdata
kitsamples/catalogcustomer/catalogcustomer.json (already adjusted):
Place a catalog plugin element on your page
The catalog plugin offers this elements:
- catalog
- detail
- lineedit
To add an edit function to the list, please look for the "edittype" in the general description. For more information for placing elements on your page look to HTML output.
Datadefinition
The "searchcolumn" is the column for the SQL WHERE condition. In this example it's build up in the call back function: cbcatAfterContainer() (look to the JavaScript Chapter).
The "filter_catalog" is a default filter especially added for the catalog output. Attention, it's not used in this example!
The "search_mode" defines:
- 0=no search
- 1=standard search
- HTML form is necessary
- JavaScript is necessary
The "search_internal" defines an internal load of the data. If it's set to false the submit reloads the whole page.
This are special parameters for the catalog example:
Properties and sections:
- name: the displayed name
- key: necessary for edit
- rightcheck: look to the explanation
- masterdata: the main parameters
- tabulator: used for master data form and for the format of numbers and dates in HTML output. Please have a look to: tabulator.info
- k8form: please have a look to: k8form
- html: the html snippets
- data: for form and catalog
To change the look of your masterdata form, please configure tabulator (list at the top) and k8form (form at the bottom)
JSON structure:
The key column is used for edit functions. If the key value is zero, it's a new record.
rightcheckThe backend adds automatically:
settings.masterdata:
- right_usercreate: "0" or "1"
recordset
- right_userupdate: "0" or "1"
- right_userdelete: "0" or "1"
Pagination
HTML Output offers a pagination with the following parameters:
The pagination sends the offset (mytable_offset) to the backend with the data read request. In this case the record number is added to each recordset: field=k8_recordcount.
HTML in this example
If an HTML file is saved in the datadefinition folder following to a specific naming convention, it is automatically added to the datadefinition.
- <datadefID>_<object>_record.html
- catalogcustomer_catalog_record.html
It is added to:
by generationg the datadefinition the html is inserted into the datadefinition:
masterdata/templates/catalog_container.html:
kitsamples/catalogcustomer/catalogcustomer_catalog_container.html:
kitsamples/catalogcustomer/catalogcustomer_catalog_record.html:
kitsamples/catalogcustomer/catalogcustomer_catalog_nodata.html:
HTML for catalog in general
This are the default outputs, htmlout=<htmlout>:
- catalog
- detail
- lineedit
The html snippets define the appearance of your web page. Design your snippets.
settings.html.masterdata.<property>:
- layout
- container
- record
- recinput
- recdisp
- nodata
- blank
Create a folder for the datadefnition, name: <datadefID>. Write the HTML-Files with this names:
<datadefID>_<htmlout>_<property>.html
recinput
Attention this is not used in this example. It allows to define a form for the data input. If the placeholder {{js_dataform}} is present, the form is generated by k8form.
Please regard in your snippets the classes:
- "js_inlineform"
container
filename: masterdata/templates/catalog_container.html
A filter form (id="filterform" method="GET") is inserted in the header line. The input is named "search". If a search parameter is set the is send to the server. Otherwise the blank snippet is displayed. Without blank template the Ajax request is directly send to the server.
Please regard in your snippets the classes:
- js_rec_container
- js_rec_head
- js_rec_records
record
filename: masterdata/templates/catalog_record.html
Please, replace the placeholder {{{{headtitlecolumn}}}} and {{{{headdescriptioncolumn}}}} with your table columns. Place additional record fields like you want. Of course you also can totally change the markup.
Please regard in your snippets the classes:
- js_rec_record: important!
- js_inlineform: optional for the form
blank
Attention, this parameter is not used in this example.
If a "blank" template exist, it will be displayed instead of the records.
nodata
filename: kitsamples/catalogcustomer/catalogcustomer_catalog_nodata.html
You can change this markup completely and also put images in.
JavaScript
filename: kitsamples/catalogcustomer/catalogcustomer.js
Line 1: the header tag is changed for this page to <h2>
Line 4: the call back functions for tinymce are added to the datadefinition by datadefAddtinymce(...)
Line 5: the call back function "cbcatLoad" is used to set the link to the detail page. The keyvalue is added to the link.
extract from filename: js/example.js
Line 1+2: a HTML layout can be added, in this case not!
Line 4: defines the HTML which is outputted.
Line 5: the edittype is overwritten with '1':inline.
Line 7: by search_mode>1 the call back function "cbcatAfterContainer" is added by exk8.datadefAddSearch(...). The function is described below:
method: k8.datadefAddSearch(...)
This method is working well in our example. It can be used as draft for an own search method.
Javascript helps with 3 issues:
- if a search value is entered,
- it deletes the blank template; without blank-template the data is loaded
- it builds the filter expression
- search_internal
- true: an eventlistener is added and the function "options.loaddata()" is called to load and display the records
- false: submit reloads the page with the new search
add tinymce
masterdata/templates/tinymceset.js
Create your datadefintion JavaScript file. Copy the line from the template into your file and add your datadefID to the settings variable.
additional declarations in the datadefinition: