This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".  
Status: 2023-12-31


Template Engine Smarty

  • Emvicy makes use of the robust Template Engine Smarty Version 4.
  • All Templates you define in your module's template folder.
  • Emvicy provides a standard set of template files if you create your module via emvicy (see: Creating a Module).
  • See the directory structure of the standard set of templates: /1.x/directory-structure#modules-moduleName-templates

For more Information about how to code templates with powerful Smarty Template Engine please visit the official Website


assign any variable to your template

assign any variable to your template (assuming module is Foo)

\Foo\View\Index::init()->assign('myFrontendVariable', 'Any Content');

In your template you can access that assigned variable this way:


autoAssign variables

If you created your module via Emvicy.phar (see: Creating a Module) or you added additional context information to your route by yourself, you can easily auto assign all additional route infos:

autoAssign variables to template (assuming module is Foo)



render the template (assuming module is Foo)


controlling rendering

switch on/off rendering templates

render off


render on


controlling echo out

switch on/off to echo out the rendered result

echoOut off


echoOut on


Accessing Class methods and objects in smarty template

You can access any Emvicy Class directly in the templates.


// gives BasePath

// debugs additional info of the current route object

Also you can access methods of assigned Objects: