Topic on Talk:Requests for comment/MVC framework

Dantman (talkcontribs)
  • 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.
Owyn (talkcontribs)

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.

Reply to "A few points"