Hi, everyone.
I want to share my tiny class "Views"[1] which helps me in development 
process. Many extensions created have UI-part: kind of panels, widgets, 
etc added to page output. Usually, html code just stored in some 
variable and pushed to $wgOut:

$myWidget = '<div id="my-wiget">Today weather:' .$someData. '</div>';
$wgOut->addHtml($myWidget);

But, it is more convenient, if template for this html code will be in 
separate folder, not mixed with php code.

This is what "Views" for. With it this code looks like:

$myWidget = Views::forge('widget', array('some' => $someData) );
$wgOut->addHtml( $myWidget );

Extension have "views" folder in root
(e.g. /extensions/MyWidget/views ), which contains widget.php file with 
contents:

<div id="my-wiget">Today weather: <?=$some?> </div>

So, after "Views"[1] call, $myWidget variable will hold the result.

You can download this helper as extension for Mediawiki and use it, 
after include in LocalSetting.php

[1] https://github.com/vedmaka/Mediawiki-Views


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to