feel free to keep it strictly simple...

lib_TWIG_box: usage

Since L* 3 you should take the lib_twig_box instead of the "register_parser"-technique for backend/frontend templates.
Its more easy and stable and more less of code at all.

 

Example:

lib_twig_box

A simple example from the module "display_code"

  1. $oTwig = lib_twig_box::getInstance();
  2. $oTwig->registerModule("display_code");
  3. echo $oTwig->render(
  4. "@display_code/modify.lte", // template-filename
  5. $form_values // template-data
  6. );

Listing 2.1 :: lib_twig_box example

See also LEPTON_tools
last edit: 12. Mar 2024 CET 20:12:17

As you can see in listing above you will only have to

  1. [line 1]: get an (singelton) instance of the class. 
  2. [line 2]: register your module so the Twig-Template-engine knows where to look for the used files. (inside the module folder or optional inside the frontend/them template)
  3. [line 4 ff.]: render your files/data as you need