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"
- $oTwig = lib_twig_box::getInstance();
- $oTwig->registerModule("display_code");
- echo $oTwig->render(
- "@display_code/modify.lte", // template-filename
- $form_values // template-data
- );
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
- [line 1]: get an (singelton) instance of the class.
- [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)
- [line 4 ff.]: render your files/data as you need