In all the new features of Moodle 2.9,the theme designers will really love the support added for implementing renderers as Mustache – logic less templates.
As per the tracker issue MDL-49152, Moodle 2.9 has been fixed with the mustache support for templates which allows identical calling from php or javascript.
A template is an alternative to writing blocks of html directly in javascript / php by concatenating strings. The end result is the same, but templates have a number of advantages:
- It is easier to see the final result of the template because the code for a template is very close to what the final HTML will look like
- Because the templating language is intentionally limited, it is hard to introduce complex logic into a template. This make it far easier for a theme designer to override a template, without breaking the logic
- Templates can be rendered from javascript. This allows ajax operations to re-render a portion of the page.
For more details, read the Moodle 2.9 release notes here: https://docs.moodle.org/dev/Moodle_2.9_release_notes#For_developers
For more details about Templates: https://docs.moodle.org/dev/Templates#Templates & http://mustache.github.io/mustache.5.html