Problem
Smarty template files are hard to edit. Editing the source by hand is a pain. WYSIWYG editors sometimes do not render/parse the templates properly. Even when there are no problems, the Smarty logic and variables make things quite confusing.
More on the problem - a user's perspective:
- Loss of modifications on upgrade To modify Tikiwiki for real-world applications, extensive template modifications are needed. But they're overwritten when you upgrade to a new version.
- Styles and templates Some styles assert their own templates, which take precedence over the default templates. However, the style-asserted templates are not available for editing in Edit Templates; therefore, some modifications in Edit Templates appear to have no effect (which is confusing).
Possible solutions?
How can we make editing Smarty templates in WYSIWYG editors more like editing normal XHTML files? These are some ideas I had. They may or may not make things easier. Please give feedback.
Changing Smarty tpl delimiter tag syntax (for wysiwyg editors)
- Some believe that using <{ }> as opposed to { } as delimiters make WYSIWYG editors play nice
- In theory, <!
{ }> as delimiters would hide all Smarty tags - We may not want to hide Smarty variables; we can use <{ }> for variables and <!
{ }> for logic - Renaming templates to .tpl.html would allow WYSIWYG editors to open them easily.
- Use code highlighting schemas for various editors, ex. Dreamweaver
Useful links
- Smarty highlighters for HomeSite, jEdit, NEdit, UltraEdit, and vim.
- Smarty highlighter for ConTEXT Programmers' Editor.
- Keyboard templates for Smarty in PHPEdit.
- Please see the Smarty Aids file gallery for some helpful files, like Dreamweaver extensions.
- A Word About Template Engines
- Here you'll find a Dreamweaver extension that works with smarty templates