Extension:Views
From Linux Web Expert
<translate> This extension is currently not actively maintained!</translate> <translate> Although it may still work, any bug reports or feature requests will more than likely be ignored.</translate> |
Views Release status: unmaintained |
|
---|---|
File:Extension-Views.png | |
Implementation | MyWiki |
Description | Allows to avoid inline HTML |
Author(s) | (Vedmakatalk) |
Latest version | 0.1 (2013-08-24) |
MediaWiki | 1.18+ |
Database changes | No |
License | GNU General Public License 3.0 |
Download | GitHub:
<translate> Note:</translate> README |
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
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
- <translate> <tvar name=1>Download</tvar> and place the file(s) in a directory called <tvar name=name>
Views
</tvar> in your <tvar name=ext>extensions/
</tvar> folder.</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
require_once "$IP/extensions/Views/Views.php";
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Usage
- While developing an extension create directory called "views" in your extension folder.
- Place some standard php-templates in this directory, for example: template.php with contents
<div> <p><? echo $a ?></p> </div>
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:
<div> <p>hello</p> </div>
That's it!
Categories:
- Pages with script errors
- Pages with broken file links
- Unmaintained extensions
- Personalization extensions
- Extensions without a compatibility policy
- Extensions with manual MediaWiki version
- GPL licensed extensions
- Extensions in GitHub version control
- All extensions
- Extensions not in ExtensionJson
- Extensions not using extension registration