Differences between version 3 and predecessor to the previous major change of Help/TemplatePlugin.
Other diffs: Previous Revision, Previous Author
Newer page: |
version 3 |
Last edited on 9 September 2007 0:16 |
by harold |
Revert |
Older page: |
version 2 |
Last edited on 22 May 2014 3:01 |
by harold |
Revert |
@@ -1,143 +1,72 @@
-The **Template** [[Help:WikiPlugin|plugin]] allows to include text from a wiki page and replace certain placeholders by parameters.
-A template can be seen as a parametrized block. It is similiar to [[CreatePage]] with the template argument, but at run-time
.
+Template = Parametrized blocks
.
-There are two syntaxes to call
a template, the usual Phpwiki syntax for plugins, and a more
-concise syntax similar
to Mediawiki
templates.
+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
+<verbatim>
+ <?plugin Template page
=Templates/Footer?>
+ <?plugin Template page
=Templates/Film vars="title=SomeFilm&year=1999" ?>
+ {{Templates/Film|title
=SomeFilm|year
=1999}}
+</verbatim>
-=== Without parameters ===
+!! Plugin Arguments
+Argument|
+ Default Value|
+ Description
-Plugin syntax:
-{{{
-<<Template page=Footer>>
-}}}
+page|
+ (empty)|
+ pagename to be included as template
-Short syntax:
-{{{
-{{Footer}}
-}}}
+vars|
+ (empty)|
+ optional parameters to be expanded inside the template
+! Parameter expansion:
+ vars
="var1
=value1&var2
=value2"
-Plugin syntax:
-{{{
-<<Template page=Film vars="title=SomeFilm&year=1999">>
-
}}}
+We only support named parameters, not numbered ones as in mediawiki, and
+the placeholder is %%var%% and not
{{~
{var~
}}} as in mediawiki.
-Short syntax
:
-{{{
-{{Film|title=SomeFilm|year=1999}}
-}}}
+The following predefined variables are automatically expanded if existing
:
+<verbatim>
+ 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
+</verbatim>
-=== With a specific revision of the page ===
+<noinclude> .. </noinclude> is stripped
-Plugin syntax
:
-{{{
-<<Template page=somepage rev
=5>
>
-}}}
+! In work
:
+* ENABLE_MARKUP_TEMPLATE = true: (lib/InlineParser.php)
+ Support a mediawiki-style syntax extension which maps
+<verbatim>
+
{{TemplateFilm|title=Some Good Film|year=1999}}
+</verbatim>
+ to
+<verbatim>
+
<?plugin
Template page=TemplateFilm vars
="title=Some Good Film&year=1999" ?
>
+</verbatim>
-Short syntax:
-{{{
-{{somepage?version=5}}
-}}}
-
-== Arguments ==
-
-{| class="bordered"
-|-
-
! Argument
-
! Description
-! Default value
-|-
-| **page**
-| pagename to be included as template
-| //None// (required argument)
-|-
-| **vars**
-| optional parameters to be expanded inside the template
-| (empty)
-|-
-| **rev**
-| page revision
-| most recent revision
-|-
-| **section**
-| just include a named section
-| (empty)
-|-
-| **sectionhead**
-| when including a named section show the heading
-| (empty)
-|}
-
-=== Page to include ===
-
-If "Template:$page" exists, it is used.
-
-Else, if "Template/$page" exists, it is used.
-
-Else "$page" is used.
-
-This allows compatibility with Mediawiki that puts templates in the "Template:" namespace.
-
-=== Parameter expansion ===
-
-We only support named parameters, not numbered ones as in Mediawiki, and
-the placeholder is %%var%% and not ~{~{~{var~}~}~} as in Mediawiki.
-
-{{{
-vars="var1=value1&var2=value2"
-}}}
-
-The following predefined variables are automatically expanded if existing:
-{| class="bordered"
-|-
-! Variable
-! Description
-|-
-| 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
-|
-|-
-| BASE_URL
-|
-|}
+<verbatim>
+ <?plugin Template page
=TemplateExample vars
="title
=TestTitle" ?>
+</verbatim>
-~
<noinclude
> .. ~</noinclude> is stripped.
+Standard syntax:
+
<?plugin Template page=TemplateExample vars="title=TestTitle" ?
>
-~<includeonly> .. ~</includeonly> is only expanded in pages using the template, not in the template itself.
+Shorter syntax:
+ {{TemplateExample|title=TestTitle}}
-<noinclude>
-
----
-[[
PhpWikiDocumentation]] [[CategoryWikiPlugin]]
-</noinclude>
+---------
----
+PhpWikiDocumentation Help:WikiPlugin
version 3
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 Plugin Template failed. Page “~{var~” does not exist.} 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%%
---
- Shorter syntax
Title: TestTitle Year: %%year%%
---
PhpWikiDocumentation
Help:WikiPlugin