Skip to content

Kitto.Html.TemplateEngine

TemplatePro integration for KittoX. Provides template loading with 3-level fallback lookup and rendering.

TKXTemplateEngine class

Wraps TemplatePro compilation and rendering, with a 3-level template lookup:

  1. App/Home/Metadata/Views/Templates/{ViewName}.html
  2. App/Home/Templates/{ControllerType}.html
  3. Kitto/Home/Templates/{ControllerType}.html (system home)
pascal
function FindTemplatePath(const AViewName, AControllerType: string): string;

Finds a template file using the 3-level fallback lookup. Returns the full path of the first matching file, or '' if not found.

pascal
function Render(const ATemplatePath: string;

Finds and compiles a template, calls ASetData to bind data, then renders and returns the resulting HTML string.

pascal
function RenderString(const ATemplate: string;

Compiles a template from a string, calls ASetData to bind data, then renders and returns the resulting HTML string.

pascal
function RenderTemplate(const AViewName, AControllerType: string;

Finds the template by view/controller name, compiles it, calls ASetData, and renders. Raises an exception if not found.

Released under Apache License, Version 2.0.