Template Plugin
Synopsis
Template = Parametrized blocks.
Include text from a wiki page and replace certain placeholders by parameters. Similiar to CreatePage with the template argument, but at run-time. Similiar to the mediawiki templates but not with the "|" parameter seperator.
Usage
<?plugin Template page=Templates/Footer?>
<?plugin Template page=Templates/Film vars="title=SomeFilm&year=1999" ?>
{{Templates/Film|title=SomeFilm|year=1999}}
Plugin Arguments
| Argument | Default Value | Description |
|---|---|---|
| page | (empty) | pagename to be included as template |
| vars | (empty) | optional parameters to be expanded inside the template |
- ! Parameter expansion
- vars="var1=value1&var2=value2"
We only support named parameters, not numbered ones as in mediawiki, and the placeholder is %%var%% and not {{{var}}} as in mediawiki.
The following predefined variables are automatically expanded if existing:
pagename mtime - last modified date + time ctime - creation date + time author - last author owner creator - first author SERVER_URL, DATA_PATH, SCRIPT_NAME, PHPWIKI_BASE_URL and BASE_URL
<noinclude> .. </noinclude> is stripped
In work:
- ENABLE_MARKUP_TEMPLATE = true: (lib/InlineParser?.php) Support a mediawiki-style syntax extension which maps
{{TemplateFilm|title=Some Good Film|year=1999}}
to
<?plugin Template page=TemplateFilm vars="title=Some Good Film&year=1999" ?>
Examples
<?plugin Template page=TemplateExample vars="title=TestTitle" ?>
- Standard syntax
Title: TestTitle? Year: %%year%% ---
- Pagename: TemplateExample
- Author: The PhpWiki programming team
- Last modified time: Tuesday 16 January 2007 19:04:42
- Created time: Tuesday 16 January 2007 19:04:42
- Owner: canoe
- Creator: The PhpWiki programming team
- SERVER_URL:
http://canoe.susu.org - DATA_PATH:
- SCRIPT_NAME: /wiki
- PHPWIKI_BASE_URL:
http://canoe.susu.org/wiki/ - BASE_URL:
http://canoe.susu.org/wiki/
- Shorter syntax
- {{TemplateExample|title=TestTitle?}}
Last edited on Tuesday 16 January 2007 19:04:42
Copyright Southampton University Canoe Club (SUCC)
This website is hosted by Southampton University Students Union.
If you would like hosting for your club or society contact us at hosting@susu.org.
The views expressed on this website are not the views of SUSU or the University of Southampton.


