Download the PHP package blue-tomato/template-engine-smarty without Composer
On this page you can find all versions of the php package blue-tomato/template-engine-smarty. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blue-tomato/template-engine-smarty
More information about blue-tomato/template-engine-smarty
Files in blue-tomato/template-engine-smarty
Package template-engine-smarty
Short Description ProcessWire module adding Smarty to the TemplateEngineFactory
License MIT
Homepage https://github.com/blue-tomato/TemplateEngineSmarty
Informations about the package template-engine-smarty
TemplateEngineSmarty
A ProcessWire module adding Smarty to the TemplateEngineFactory.
Requirements
- ProcessWire
3.0or newer - TemplateEngineFactory
2.0or newer - PHP
7.0or newer - Composer
The
1.xversion of this module is available on the 1.x branch. Use this version if you still use TemplateEngineFactory1.x.
Installation
Execute the following command in the root directory of your ProcessWire installation:
This will install the TemplateEngineSmarty and TemplateEngineFactory modules in one step. Afterwards, don't forget to enable Smarty as engine in the TemplateEngineFactory module's configuration.
ℹ️ This module includes test dependencies. If you are installing on production with
composer install, make sure to pass the--no-devflag to omit autoloading any unnecessary test dependencies!.
Configuration
The module offers the following configuration:
Template files suffixThe suffix of the Smarty template files, defaults totpl.Provide ProcessWire API variables in Smarty templatesAPI variables ($pages,$input,$config...) are accessible in Smarty, e.g.{{ config }}for the config API variable.DebugIf enabled, Smarty outputs debug information.Compile CheckIf enabled, templates are recompiled whenever the source code changes.Error ReportingIf set tofalse, Smarty will silently ignore invalid variables (variables and or attributes/methods that do not exist) and replace them with anullvalue. When set totrue, Smarty throws an exception insteadEscape HTMLIf enabled, templates will auto-escape variables. If you are using ProcessWire textformatters to escape field values, do not enable this feature.
Extending Smarty
It is possible to extend Smarty after it has been initialized by the module. Hook the method TemplateEngineSmarty::initSmarty
to register custom functions, extensions, global variables, filters etc.
Here is an example how you can use the provided hook to attach a custom function.
The above hook can be put in your
site/init.phpfile. If you prefer to use modules, put it into the module'sinit()method and make sure that the module is auto loaded.