In Venddor IO, the Smarty 4 template engine is employed, ensuring a distinct separation between presentation and application logic. Dive deeper into its workings by visiting the official Smarty website.
This section will be of significant interest to developers, elaborating on the constructs usable within templates.
Templates reside in the theme's template directory and encompass:
Several standalone files, like 404.tpl (for 404 error pages) and demo_theme_selector.tpl (for the Theme Editor), also reside here.
All module-related templates are situated within the templates/addons directory.
Block templates reside within the templates/blocks directory. Their application is determined by their role, as defined in the app/schemas/block_manager/blocks.php file.
For instance, for a 'categories' block: 'templates' => 'blocks/categories' indicates that any template from the blocks/categories directory can be applied to it.
Adopting the Model-View-Controller (MVC) pattern, Venddor IO places view templates in the views directory. Within this, directories define specific controllers.
Files within these directories outline modes. Additionally, component directories within controller directories hold templates offering additional functions, integrated via the include method in files.
To understand how a particular template is determined, consider this URL: /index.php?dispatch=categories.view&category_id=166. Here, categories is the controller fetching the data, hence the directory in views would be 'categories'. view signifies the mode, leading us to the view.tpl file. category_id is a parameter identifying the specific category to be displayed.
When working with templates in Venddor IO, consider these best practices: