Extensions

 

An extension allows you to change the template to support additional feature(s) implemented in the extension. Extensions files must be placed under the subfolder "extensions" of the installation folder.

Notes

  1. An extension is NOT a project template, do not try to select an extension as a template for generation.
  2. All extensions are only provided as examples on how to extend the template with your own code or your own implementation of third party tools, all third party tools used in them are not developed by the author of PHPMaker and are not part of PHPMaker, NO TECHNICAL SUPPORT WILL BE PROVIDED. Also see Third-party Tools for more information on the third-party tools.
  3. All third-party tools require implementation and will NOT automatically work with PHPMaker without extensions.

 

Using Extensions

Click Tools->Extensions to enable or disable these extensions. Before enabling the extension, make sure you read the notes about the extension first. If the extension has advanced settings (NOT every extension has it), you'll see the Advanced tab after selecting the extension. Click the Advanced to configure advanced settings for the extension.

In the Advanced tab, you may see Project, Tables, and Fields tabs, depending on extensions. Note that NOT every extension has all 3 tabs, some extensions may have project level settings only, some extensions may have table or field level settings also, e.g.

Note The table or field names in the Tables or Fields tabs are searchable, to find a table or field, just focus the Table or Field column by clicking the column first and then type the table or field name.

 

 

Making Extensions

It is simple to make your own extensions. Each extension has an XML description file so the product can load it in the user interface for setting up. You can open an XML file in the "extensions" subfolder to see the content. The XML file has the following structure:

<?xml version="1.0" encoding="iso-8859-1" ?>
<ew-extension name="ExtensionName" version="x.x.x" type="Extension Type" author="Author Name">
<description>
<![CDATA[
Description of the extension
]]>
</description>
<file>xxx.zip</file>
<Project>
    <Attribute name="AttributeName" type="DataType" default="xxx" />
    ...
    <Database>
        <Table>
            <Attribute name="AttributeName" type="DataType" default="xxx" />
            ...
            <Field>
                <Attribute name="AttributeName" type="DataType" default="xxx" />
                ...
            </Field>
        </Table>
    </Database>
</Project>
<control ... />
...
</ew-extension>

<ew-extension> The root node of the XML file, it contains information of the extension to be shown by the user interface.
<description> Description of the extension. Shown as "Notes" in the user interface.
<file> Zip file for the extension.

Note The zip file name must contain alphanumeric characters only (no special characters and no spaces) and must be in lower case.

The zip file contains sub-template files to change a sub-template of the same file name in the main template.

To append code to a sub-template in the main template, add a file with the same name, e.g. startup.js.

To clear generated code of the original sub-template first and then replace with your own, add the following as the first line in your sub-template:

<# args.code = ""; #>

To generate additional files, use <control> tag (see below).

<Attribute>

Optional. Properties of the extension. You can add multiple <Attribute> tags inside <Project>, <Table> and/or <Field> tag.

If the <Attribute> tag is enclosed by <Project> tag, the attribute is level, simiarly for table and field level attributes.

Make sure you set unique attribute name for each attribute. The attribute name should contain alphanumeric characters only and should not start with digit.

The type attribute specifies the data type of the value. Support types are: "Boolean", "Integer" and "Color". Others are considered as string.

The optional default attribute specifies a default value for the setting.

<control> Optional. Additional files to be generated. Same as <control> tags in Control File. You can add multiple <control> tags for an extension.

In your extension, you can get the extension properties as as follows:

<#
let projAttr, tableAttr, fieldAttr; // Declare your variables
let ext = GetExtensionObject("ExtensionName"); // Get extension object by extension name
if (ext && ext.Enabled) { // If extension enabled
    projAttr = ext.PROJ.AttributeName; // Get project level attribute value by attribute name
    ...
    if (TABLE) { // If you have table level settings
        let extTable = GetExtensionTable(extName, TABLE.TblName);
        if (extTable) {
            tableAttr = extTable.AttributeName; // Get table level attribute by attribute name
            ...
            for (let f of allFields) { // If you have field level settings, loop all fields
                let extField = GetExtensionField(extName, TABLE.TblName, f.FldName);
                if (extField) {
                    fieldAttr = extField.AttributeName; // Get field level attribute by attribute name
                    ...
                }
            }
        }
    }
}
#>

 

Note See the XML description files of the extensions, Custom View Tags or Custom Edit Tag and unzip the zip file to see the source code as examples.

 

 

Extensions shipped with PHPMaker

CKEditor 4
https://ckeditor.com/ckeditor-4/

Date/Time Picker
https://github.com/Eonasdan/bootstrap-datetimepicker

Chart.js
https://www.chartjs.org/

Captcha
Use CAPTCHA image to protect sites from spam and abuse.

Audit Trail
Provides more options for audit trail.

Dompdf
https://github.com/dompdf/dompdf
Requires DOM, GD and MBString PHP extensions.

Known issues of dompdf:
  • Not particularly tolerant to poorly-formed HTML input
  • Large files can take a while to render
  • Requires a lot of memory

 

 

Additional Extensions (For Registered Users Only)

Note These extensions are benefits for registered user only, there is NO trial version. Registered users will be provided information to download these extensions.

PhpSpreadsheet
https://github.com/PHPOffice/PhpSpreadsheet
Requires PHP extension php_zip (for Excel2007 format), php_xml and php_gd2.

PHPWord
https://github.com/PHPOffice/PHPWord
Requires PHP extension php_zip (for Excel2007 format), php_xml and php_gd2.

reCAPTCHA
https://developers.google.com/recaptcha/
Use reCAPTCHA to protect sites from spam and abuse. Note that reCAPTCHA is a Web service, it is served directly from reCAPTCHA's servers to the end users, the end users need to be online. To use the service, you must register at the reCAPTCHA Web site and obtain your own public and private keys. Requires PHP extension php_openssl.dll.

Rich FileManager (for CKEditor)
https://github.com/servocoder/RichFilemanager

TinyMCE 4
https://www.tiny.cloud/

Time Picker
https://github.com/jonthornton/jquery-timepicker

Detail Preview
Allow previewing detail records in an expanded row of the main table in List page, and/or in a popup overlay by Bootstrap Popover.

Fixed Header Table
Enable fixed table header and horizontal/vertical scrolling of the main table in the List/Report page.

Field Visibility
Allow pre-setting the Visible property of field objects for different pages or actions. This extension only sets the Visible property according to settings. Read the notes for the extension for details.

Field Encryption
Allow encryption/decryption of selected fields when updating/retrieving data to/from table. Read the notes for the extension for details.

 

 

Also See

Control File
Template Tags
Object Properties
Third-party Tools



 

 ©2002-2019 e.World Technology Ltd. All rights reserved.