feel free to keep it strictly simple...

add custom template files using register_parser.php

Using custom module-template-files in the backend or frontend was not possible in the past.

Since LEPTON 2.0.0 it is easy to do.


For the backend:

Add a file called 'register_parser.php' to the module directory with the following code:


Example from news module:

global $parser, $loader;
if (!isset($parser))
    require_once( LEPTON_PATH."/modules/lib_twig/library.php" );


$loader->prependPath( dirname(__FILE__)."/templates/backend/", $module_directory );

$backend_template_path = LEPTON_PATH."/templates/".DEFAULT_THEME."/backend/".$module_directory."/";
$module_template_path = dirname(__FILE__)."/templates/backend/";

require_once (LEPTON_PATH."/modules/lib_twig/classes/class.twig_utilities.php");
$twig_util = new twig_utilities( $parser, $loader, $module_template_path, $backend_template_path );
$twig_util->template_namespace = $module_directory;

$twig_modul_namespace = "@".$module_directory."/"
last edit: 23. Mar 2017 CET 15:55:58


For the frontend:

Add your custom template files in a folder in the template/frontend/module_directory.

Please keep in mind, that template names must be the same as in the module itself.


Notice: you can also "replace" backend.css and frontend.css files there as well as backend.js and frontend.js


Notice: if  you include header.lte or footer.lte in your lte-template files don't forget to include files together with @namespace:

{% include "@news/header.lte" %}
last edit: 23. Mar 2017 CET 15:56:31
If you need an example look for the custom template files of news module in news module, algos-theme and lepton2 template.