Posts made by Urs Hunkler

Picture of Core developers

After some further thinking about the »dynamic partial helper« I come to the conclusion that I prefer to use a »dynamic partial helper« over the rendering step Damyon had proposed and I had implemented in the latest version of the »cleanm« theme.

The main reason is not technique but concept - I think separation of code generation and layout with templates is a big advantage. When I call a renderer with a template in the code generation process for another renderer with a template I start to mix code generation and layout again.

So I prefer to be able to think about the process as three steps with as much separation as possible

  1. Get and calculate all data
  2. Create a template with the page look
  3. Fill the data into placeholders in the template to render the output

With these steps I can concentrate and work on the best solutions for back-end and front-end solutions more separated. To be able to mentally separate step 1 and step 2 helps me a lot to finetune and optimize the result.

The conclusion

So please let's implement a »dynamic partial helper« - it will be useful the same way in PHP and JavaScript.

Average of ratings: Useful (3)
Picture of Core developers

I have created a dedicated branch for the Moodle 29 Mustache work https://github.com/uhunkler/moodle/commits/MOODLE_29_mustaches. In this branch the actual state of the »cleanm« theme is one commit - I have cleaned up the commits. Please don't use the »master« branch but the »MOODLE_29_mustaches« when you want to test the »cleanm« theme.

Average of ratings: Useful (1)
Picture of Core developers

Do you know why the course context and the doctype

$contextcourse= context_course::instance(SITEID);
$doctype = $OUTPUT->doctype();

need to be called in the layout.php? I first had the two lines implemented in the »base_layout« renderable but Moodle complained - for example about the missing doctype call.

Picture of Core developers

Great that you think my work on the »cleanm« Mustache theme is helpful Gareth. You described the function of the »dynamic partial« helper. But as you can see from my related post it is not necessary. The render_from_template call in the renderable produces the same result without the helper.

I have removed the helper from my Moodle 29 branch again.

Average of ratings: Useful (1)