Forums | Mahara Community

Developers /
Switching template engines

Citizen Gold's profile picture
Posts: 9

25 November 2021, 14:47

I was just reading over the last couple of Dev meeting notes and this idea on replacing the template system.

With PHP8 coming up this is going to be something we have to do. Dwoo, the current engine, is out of support (actually abandoned) which means we would need to upgrade it ourselves and permanently support it going forward. Not an ideal option.

As the 'Replacing Smarty' (Dwoo is a fork of an old version of Smarty) idea mentions, this will be a breaking change in that every custom theme out there will no longer work.

What do people think of the following idea?

  1. Create a mahara_template() that wraps the template engine.

  2. Check a $config var for which template engine is in use.

  3. Process vars and files using the selected engine.

This would allow us to leave the existing system in place so existing sites, especially those with custom themes, just keep working.  It would also allow us to add a new PHP8 compatible template engine alongside the existing one.  The new templates can be converted in a less stressful manner. Once released new sites should be encouraged to use the new engine and it made very clear that the old engine should not be used on servers running PHP8.  Sites wanting to upgrade to PHP8 will be able to run the same codebase while upgrading their custom themes, etc.


Citizen Gold's profile picture
Posts: 9

09 February 2022, 8:03

Just thinking about it...  Step 2 should probably be "Check the theme config to determine which template engine it is built for."

Dianne Tennent's profile picture
Posts: 13

22 February 2022, 9:58

This sounds like a really good way to manage the transition smoothly, causing the least disruption.

3 results