Talk:Requests for comment/MVC framework
Add topicAppearance
Latest comment: 10 years ago by Ricordisamoa in topic Mustache
This page used the LiquidThreads extension to give structured discussions. It has since been converted to wikitext, so the content and history here are only an approximation of what was actually displayed at the time these comments were made. |
A few points
[edit]- Eh, "MVC"? The majority of this RFC looks more like it's talking about a template system, not MVC.
- PHP 5.4 is nice and we'd all love to have its great advantages, but MediaWiki still supports PHP 5.3, do be aware of that while touting 5.4's array syntax and examples like
<?= $data1 ?>
which in real code would be<?php echo $data1 ?>
because <?= being always available is a 5.4 feature and we still support 5.3 with it disabled. - But more importantly, the examples
<?= $data1 ?>
and<li><?= wfMessage($msg1)->text(); ?> </li>
looks like raw html being dumped into the page without any consideration at all for escaping. In this regard the proposal looks to be inferior to our existing QuickTemplate system. Daniel Friesen (Dantman) (talk) 04:22, 19 December 2013 (UTC)
- Good point, the only examples I really showed were the template examples. There is definitely an entire "Controller" part, which handles all the logic and escaping of input and has it's own sort of design approach. There isn't a model, it's just a View/Controller framework but that's how we refer to it internally so it just slipped into the name of the proposal. The main idea is that only _data_ is passed from the controller to the template though, and we use the Controller object itself to hold that data because it makes the code less "fiddly" that way. The template is just for placing the final/sane/sanitized output in the right place in the HTML. Even calling wfMessage() is discouraged, the example was just to show that it's possible. The controller is documented more fully in the existing external documentation, but I will add those examples to this proposal so it's more self contained. Wikia doesn't care about support for PHP 5.3, but this would be made compatible and I will remove that from the examples because it's just a distraction. It's specifically designed as a replacement for QuickTemplate as well. The main advantages from our perspective is the reduction of boilerplate syntax overhead of having to declare templates as objects with an execute() function and the ability to call controller functions to get data separately from rendering, and the ability to compose templates into larger things (like the entire Oasis skin, which is made up of lots of these small templates). Thanks for the feedback, I think it will make the proposal a lot better. Owyn (talk) 03:58, 22 December 2013 (UTC)
Twig
[edit]Twig! Jeroen De Dauw (talk) 22:20, 19 March 2014 (UTC)
Mustache
[edit]As Dantman wrote, this RFC actually appears to be about a template system.
Per Requests for comment/HTML templating library, MediaWiki now ships with Mustache. Ricordisamoa 03:03, 11 April 2015 (UTC)