Manual: HTML templates - Media. Wiki. Starting with Media. Wiki 1. 2. 5, Media. Wiki can generate HTML content from Mustache templates on the server and on the client. Server- side template parsing is implemented in PHP via the Template. Parser class, which acts as a wrapper around the lightncandy library. Client- side templates are supported via mediawiki. Resource. Loader modules and the mustache. Note: This is unrelated to the use of Media. Wiki templates in wikitext (such as the . Templating here builds the HTML of a web page, not the wiki content within it. Creating templates. Templates should contain as little programming logic as possible so that they are easily readable and provide proper separation of concerns. If your template is part of the core Media. Wiki software, put it in core's includes/templates directory. If it is part of an extension, you should create a dedicated templates directory within your extension's directory to hold it. Templates should follow the Mustache- 5 specification. This class finds template files, reads them, compiles them into PHP code, and expands tags in the template using data you provide to produce the output HTML. Media. Wiki compiles templates as needed, and uses caching to store the compiled templates if available (see #Caching below). This avoids developers having to compile templates into PHP files during development or as a build step, or the server writing them to the file system during operation. To use Template. Parser, first create a new instance of the class: $template. Parser=new. Template. Parser(); If your Mustache templates do not reside in core's includes/templates, you need to pass the path to where they reside as the first parameter to the constructor (either relative to your Media. Wiki root or relative to the calling file's directory with . The first parameter to this is the name of your template (the part of the filename before . In order to use HTML tags such as and in your MediaWiki pages, you should add the following line to your LocalSettings.php file. The contents of one page can be placed onto another page by using a template. This page and Help:Advanced templates are a reference manual on templates in MediaWiki. The second parameter is an array providing the values needed by the Mustache tags in your template. For example,echo$template. Parser- > process. Template('My. Widget',array('username'=> $user- > get. Name(),'message'=> 'Hello!')); This replaces any instances of . It prefers to use CACHE. HHVM has it built- in. Partials. However, this does not notice changes to . So if you change a partial, you need to make cosmetic changes to the parent templates that include it, or restart your cache. To use a Mustache template on the client- side, add it to your Resource. Loader module definition first: 'ext. Extension. interface'=> array('templates'=> array('foo. The template definition above consists of two pieces, a file path (templates/foo. The alias must be suffixed with the name of the templating language (e. Resource. Loader automatically serves the supporting mediawiki. Java. Script modules, so you don't need to mention anything in dependencies. Once you have added the template to your module, you can retrieve it in Java. Auto-populating page with template when its created. Auto-populating page with template when its created. Although HTML table syntax also works, special MediaWiki code can be used as a shortcut to create a table. Formatting codes function the same as in HTML table markup. There are some things you'll find in this template that you won't find in most other DokuWiki templates, and are inspired by Wikipedia and MediaWiki. Script using mw. template. Template=mw. template. Extension. interface','foo. ![]() To render the template and data into HTML output, call the compiled template's render() function: data=. See https: //mustache. Partials for more information. Media. Wiki Templates. Newsgroups: gmane. Date: Sat, 2. 7 Jan 2. I have a Media. Wiki page listing all the rivers of the world . Whenever someone creates a .
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2016
Categories |