- Joomla! VirtueMart 1.1 Theme and Template Design
- Joseph Kwan
- 674字
- 2021-04-02 19:28:28
Roles of VirtueMart themes and templates
It should be clear by now that template files control the HTML display on the browser. So the color, font style, font size, data field arrangement, and layout are the major jobs of a template. By invoking a different template file, the browser display will look very different. Depending on the nature of an HTML page, the final HTML code may be generated by one or more template files. The product detail page (usually referred to as the flypage), for example, makes use of several template files and its appearance will change when any one of the templates change. We will work on the details of this in Chapter 4, Product Details Templates.
Since the final look of a page may vary with a group of template files, it is important that the templates are consistent with each other. Mix and match of various template files may work sometimes, but will definitely seem not so well-organized and professional. Furthermore, the output of a template also depends on various configuration settings of VirtueMart. So there is a need to group the template files into a full unit. Each of these full units is named as a theme in VirtueMart.
The original intention of the template system is to separate processing logic from the final presentation. So you will find that most of the templates only take care of presentation, that is, the look of the final browser page. However, as highly diversified customization demands come up, more and more processing logic is introduced into the template. Initially, the processing logic is added by amateur developers into the template because they are not aware of the importance of separating the data from presentation. However, soon even professionals will find it necessary to place some processing logic into the template file when they do customizations.
There are two major reasons to introduce logic into templates. The first one is to restrict the changes made to the core files. Often, when processing logic changes, the presentation will need to be changed to make use of the new logic. So each change will involve both the processing logic in the HTML file as well as the presentation code in the template file. Putting the processing logic in the template will avoid the changes in the HTML file and thus reduce the number of modified files.
The second reason for putting processing logic into a template is for backward compatibility during version upgrade. As the major role of template files is for presentation, essential changes to the template are less frequent than the HTML pages. This is especially true for security upgrades. Template files are less prone to security problems and compelling changes are usually not needed. Restricting changes just to template files will affect customization less during version upgrade.
Due to the need for restricting changes to within the template file, VirtueMart even introduces a new way to extend the core functions using theme starting from version 1.1.4 onwards. In the previous section, we explained that the ps_
class files in VirtueMart handle most of the data logic. From version 1.1.4, all the ps_
class files can be overridden using a custom-built class file by putting that custom-built file in the theme directory. A new configuration item is added to VirtueMart to enable the new feature. This means that in case we need to modify or introduce new logic to the data model, the modifications can be done through a custom file in the theme. Since these custom files are not core files, they will not be modified during version upgrade. The new feature thus helps to reduce the impact of version upgrade on customization. Unfortunately, this feature only applies to class files, but not to HTML files. So, in case you need to change the processing logic, you cannot override the HTML file using a theme. Instead, you will either need to overwrite the HTML file with your changes or place the logic in the template file, if that is an option.
- 突破平面Photoshop UI界面設計與制作剖析
- 常用工具軟件案例教程
- IBM Lotus Notes 8.5 User Guide
- CoffeeScript Application Development
- After Effects全套影視特效制作典型實例(第2版)
- ImageMagick Tricks
- SolidWorks 2018快速入門及應用技巧
- 新印象Premiere短視頻拍攝+剪輯+特效關鍵技術
- Vue.js實戰
- 夢幻森林Procreate童話風插畫繪制專業技法
- WordPress Multisite Administration
- AutoCAD計算機輔助設計標準教程(慕課版)
- Building Online Stores with osCommerce: Beginner Edition
- 讓你的PPT更精美:美化PPT必備100招
- Autodesk Inventor中文版從入門到精通(2020版)