Extension:Views

Category:Unmaintained extensions#Views Category:Extensions without a compatibility policyCategory:GPL licensed extensions
MediaWiki extensions manual
Views
Release status: unmaintainedCategory:Unmaintained extensions
Implementation MyWiki Category:Personalization extensions
Description Allows to avoid inline HTML
Author(s) (Vedmakatalk)
Latest version 0.1 (2013-08-24)
MediaWiki 1.18+Category:Extensions with manual MediaWiki version
Database changes No
License GNU General Public License 3.0
Download Category:Extensions in GitHub version control
README
Quarterly downloads 0
Category:All extensionsCategory:Extensions not in ExtensionJson

The Views extension brings some templating in dev process to separate HTML and PHP which allows to avoid inline HTML.

Instead of using inline HTML blocks in PHP, just use Views.

Installation

Usage

  1. While developing an extension create directory called "views" in your extension folder.
  2. Place some standard php-templates in this directory, for example: template.php with contents
{{#parsoid\0fragment:0}}'''<? echo $a ?>'''{{#parsoid\0fragment:1}}

Somewhere in your code call Views:

$data = array( $a => 'hello' );
$html = Views::forge('template', $data);

This will parse template, extract variables and return result into $html variable.

Result will be:

{{#parsoid\0fragment:2}}'''hello'''{{#parsoid\0fragment:3}}

That's it!

Category:All extensions Category:Extensions in GitHub version control Category:Extensions not in ExtensionJson Category:Extensions not using extension registration Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:GPL licensed extensions Category:Personalization extensions Category:Unmaintained extensions