Skip to content

Github mirror of MediaWiki extension Views - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing

License

Notifications You must be signed in to change notification settings

wikimedia/mediawiki-extensions-Views

Repository files navigation

Mediawiki-Views

Views

Views extension for Mediawiki. Brings some templating in dev process to separate html and php.

Instead of using inline html blocks in php, just use Views.

Example

  • Create folder named views in your extension folder.
  • Put some php-template in this folder, for example mytemplate.php with some content:
<div class="hello-div <?=$b?>">
<p> <?=a?> </p>
</div>
  • Call Views. To feed template with some data push array to second parameter:
$data = array( 'a' => 10, 'b' => 'hello' );
$html = Views::forge('mytemplate', $data);

Result will be stored in $html variable:

<div class="hello-div hello">
<p> 10 </p>
</div>

Thats it!

About

Github mirror of MediaWiki extension Views - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages