• Differences between current version and predecessor to the previous major change of Help/TemplatePlugin.

    Other diffs: Previous Revision, Previous Author

    Newer page: version 2 Last edited on December 16, 2018 by hege
    Older page: version 1 Last edited on March 9, 2017 by hege Revert
    @@ -1 +1,143 @@
    -<?plugin RedirectTo page="Help /WikiForumPlugin " ?
    +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.  
    +  
    +There are two syntaxes to call a template, the usual Phpwiki syntax for plugins, and a more  
    +concise syntax similar to Mediawiki templates.  
    +  
    +== Usage ==  
    +  
    +=== Without parameters ===  
    +  
    +Plugin syntax:  
    +{{{  
    + <<Template page=Footer>>  
    +}}}  
    +  
    +Short syntax:  
    +{{{  
    +{{Footer}}  
    +}}}  
    +  
    +=== With parameters ===  
    +  
    +Plugin syntax:  
    +{{{  
    +<<Template page=Film vars="title=SomeFilm&year=1999">>  
    +}}}  
    +  
    +Short syntax:  
    +{{{  
    +{{Film|title=SomeFilm|year=1999}}  
    +}}}  
    +  
    +=== With a specific revision of the page ===  
    +  
    +Plugin syntax:  
    +{{{  
    +<<Template page=somepage rev=5>>  
    +}}}  
    +  
    +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  
    +|  
    +|}  
    +  
    +== Inclusion ==  
    +  
    +~<noinclude> .. ~</noinclude> is stripped.  
    +  
    +~<includeonly> .. ~</includeonly> is only expanded in pages using the template, not in the template itself.  
    +  
    +<noinclude>  
    +----  
    +[[PhpWikiDocumentation]] [[CategoryWikiPlugin]]  
    +</noinclude

    current version

    The Template 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.

    There are two syntaxes to call a template, the usual Phpwiki syntax for plugins, and a more concise syntax similar to Mediawiki templates.

    Usage

    Without parameters

    Plugin syntax:

    <<Template page=Footer>>

    Short syntax:

    {{Footer}}

    With parameters

    Plugin syntax:

    <<Template page=Film vars="title=SomeFilm&year=1999">>

    Short syntax:

    {{Film|title=SomeFilm|year=1999}}

    With a specific revision of the page

    Plugin syntax:

    <<Template page=somepage rev=5>>

    Short syntax:

    {{somepage?version=5}}

    Arguments

    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:

    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

    Inclusion

    <noinclude> .. </noinclude> is stripped.

    <includeonly> .. </includeonly> is only expanded in pages using the template, not in the template itself.

Warning: "Declaration of HtmlUnifiedDiffFormatter::lines($lines, $class, $prefix = false, $elem = false) should be compatible with DiffFormatter::lines($lines, $prefix = ' ')"