I am developing a new activity module, and would like to make use of the Mustache templating engine. I have managed to create different pages for my module (e.g. view.php, add.php, etc.) and managed to pass basic data to the renderables. It seems as though the renderer also works fine, as the correct data is displayed on the resulting page (using a very basic Mustache template - similar to the one shown in the documentation).
I am a bit confused as to what extent I should be using Mustache templates to display and organise data. Say for example, I have a DB query that returns a bunch of records, which ideally should be displayed in a table. Do I generate the table in my Mustache template using the resulting array? Or should I do it another way?
Another example would be form elements. How do I display a form element using the form API? How does that tie in with Mustache templates?
Should the entire page be organised and displayed using the templates (aside from headers, footers and the rest of the 'core' Moodle stuff). If so, does that mean the html_writer class is now unnecessary or redundant?
Apologies if the above are stupid questions, but I am having a really hard time figuring things out from the documentation, or the few examples in the Moodle core code.
Cheers,
Fred