Recommend this page to a friend! |
Classes of Nic Latyshev | BlitzTemplateControl | README.md | Download |
|
DownloadBlitzTemplateControlWrapper for Blitz template PHP extensions. Realize many support templates store type: original separate tpl files, single php file and Redis cache suport. Also always preload all Blitz includes by this includes content. Required
UsageJust include class file, create templates, make your data and apply template Directory structureSeparate TPL files modeIf you use separate templates files, ?reate a folder "TemplatesTPL" in the same place as the class file. Name of this folder set in public property 'relative_tpath_separates_blitz' in class. Templates for each set must be in the folder with the name of this set.
Single PHP-file modeIf you use single PHP-file mode with all set templates in one PHP-file with '$templates' array, create a folder "TemplatesPHP" in the same place as the class file. Name of this folder set in public property 'relative_tpath_singlefile_blitz' in class. Templates for each set must be in the one file with the name of this set + .tmpl.php
Example
Redis CacheAlso you can cache templates in Redis, there will be fully expanded templates, in which all inclusions are replaced by this content. Templates are stored in the HSET with a key name 'Template:'.SomeSetName.':'.md5(FILENAME). In this mode, every time the templates are loaded, the date of modification of the files or file is checked, if any templates in the file are fresh than the data in the Redis, then the cache is updated with new TTL. If the templates in the files have not changed, then only the update key TTL |