Template:Forum url: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Anchoring fix - the post anchoring is now at the very end of the URI, and only if 'p' has been supplied and 'anchor' has not.)
(Added support for a 'u' parameter for specifying a forum user number.)
Line 1: Line 1:
{{project infrastructure|forum|link=no}}<!--
{{project infrastructure|forum|link=no}}<!--
   -->{{#if: {{{f|{{{t|{{{p|{{{anchor|{{{hilit|}}}}}}}}}}}}}}}
   -->{{#if: {{{u|}}}
      | {{#if: {{{t|{{{p|{{{anchor|{{{hilit|}}}}}}}}}}}}
      | /memberlist.php?mode=viewprofile&u={{{u}}} <!-- URI component required for showing a user -->
          | /viewtopic.php? <!-- Add viewtopic.php if any parameters, excluding 'f', are supplied. -->
      | {{#if: {{{f|{{{t|{{{p|{{{anchor|{{{hilit|}}}}}}}}}}}}}}}
          | /viewforum.php? <!-- Add viewforum.php if only the 'f' parameter is supplied. -->
          | {{#if: {{{t|{{{p|{{{anchor|{{{hilit|}}}}}}}}}}}}
        }}
              | /viewtopic.php? <!-- Add viewtopic.php if any parameters, excluding 'f', are supplied. -->
    }}<!--
              | /viewforum.php? <!-- Add viewforum.php if only the 'f' parameter is supplied. -->
  -->{{#if: {{{f|}}}
            }}
      | f={{{f}}}<!--
        }}<!--
      -->{{#if: {{{t|{{{p|{{{hilit|}}}}}}}}} | &}}<!-- Add an ampersand if t, p or hilit are present afterwards. -->
      -->{{#if: {{{f|}}}
    }}<!--
          | f={{{f}}}<!--
  -->{{#if: {{{t|}}}
          -->{{#if: {{{t|{{{p|{{{hilit|}}}}}}}}} | &}}<!-- Add an ampersand if t, p or hilit are present afterwards. -->
      | t={{{t}}}<!--
        }}<!--
      -->{{#if: {{{p|{{{hilit|}}}}}} | &}}<!-- Add an ampersand if p or hilit are present afterwards -->
      -->{{#if: {{{t|}}}
    }}<!--
          | t={{{t}}}<!--
  -->{{#if: {{{p|}}}
          -->{{#if: {{{p|{{{hilit|}}}}}} | &}}<!-- Add an ampersand if p or hilit are present afterwards -->
      | p={{{p}}}<!--
        }}<!--
      -->{{#if: {{{hilit|}}} | &}}<!-- Add an ampersand if hilit is present afterwards -->
      -->{{#if: {{{p|}}}
    }}<!--
          | p={{{p}}}<!--
  -->{{#if: {{{hilit|}}}
          -->{{#if: {{{hilit|}}} | &}}<!-- Add an ampersand if hilit is present afterwards -->
      | hilit={{{hilit}}}
        }}<!--
    }}<!--
      -->{{#if: {{{hilit|}}}
  -->{{#if: {{{anchor|{{{p|}}}}}}<!-- Post anchoring -->
          | hilit={{{hilit}}}
      | &#35;{{#if: {{{anchor|}}}
        }}<!--
          | {{{anchor}}}
      -->{{#if: {{{anchor|{{{p|}}}}}}<!-- Post anchoring -->
          | p{{{p}}}
          | &#35;{{#if: {{{anchor|}}}
                    | {{{anchor}}}
                    | p{{{p}}}
                  }}
         }}
         }}
     }}<noinclude>
     }}<noinclude>
Line 38: Line 41:
  {{!}} ''t''      =
  {{!}} ''t''      =
  {{!}} ''p''      =
  {{!}} ''p''      =
{{!}} ''u''      =
  {{!}} ''anchor'' =
  {{!}} ''anchor'' =
  {{!}} ''hilit''  =
  {{!}} ''hilit''  =
Line 47: Line 51:


; p: Post number to be passed to phpBB's viewtopic.php (optional).
; p: Post number to be passed to phpBB's viewtopic.php (optional).
; u: User number to be passed to phpBB's memberlist.php (optional).  If supplied, the {{param|f}}, {{param|t}}, {{param|p}}, {{param|anchor}}, and {{param|hilit}} parameters will be ignored.


; anchor: HTML anchor, used for jumping to posts (optional).
; anchor: HTML anchor, used for jumping to posts (optional).
Line 115: Line 121:


{{forum url|p=111333|hilit=contains+a+problem}}
{{forum url|p=111333|hilit=contains+a+problem}}
=== User ===
{{obr}}forum url{{!}}u=2{{cbr}}
{{forum url|u=2}}


== Related templates ==
== Related templates ==

Revision as of 15:17, 6 June 2019

https://forum.flightgear.org

The following template description is not displayed when the template is inserted in an article.

Goal

This template is used to create URLs for subforums, topics or posts on the FlightGear forum.

Usage

{{forum url
| f      =
| t      =
| p      =
| u      =
| anchor =
| hilit  =
}}
f
Forum number to be passed to phpBB's viewtopic.php (optional).
t
Thread number to be passed to phpBB's viewtopic.php (optional).
p
Post number to be passed to phpBB's viewtopic.php (optional).
u
User number to be passed to phpBB's memberlist.php (optional). If supplied, the f, t, p, anchor, and hilit parameters will be ignored.
anchor
HTML anchor, used for jumping to posts (optional).
hilit
Words on the forum posts to be highlighted (optional). Words should be separated by the plus character "+".

Technical details

The protocol and domain name part of the URI is built using the {{project infrastructure}} template.

Examples

No arguments

{{forum url}}

https://forum.flightgear.org

A subforum (The FlightGear project)

{{forum url|f=42}}

https://forum.flightgear.org/viewforum.php?f=42

A topic (FlightGear Newsletter)

{{forum url|t=7794}}

https://forum.flightgear.org/viewtopic.php?t=7794

A post (Re: Marking topics as "solved")

{{forum url|p=111333}}

https://forum.flightgear.org/viewtopic.php?p=111333#p111333

Subforum, topic and post

Note  The f and t parameters are redundant in this URL.
{{forum url|f=8|t=10805|p=111333}}

https://forum.flightgear.org/viewtopic.php?f=8&t=10805&p=111333#p111333

Topic and post

Note  The t parameter is redundant in this URL.
{{forum url|t=10805|p=111333}}

https://forum.flightgear.org/viewtopic.php?t=10805&p=111333#p111333

Anchoring

{{forum url|t=10805|anchor=p111333}}

https://forum.flightgear.org/viewtopic.php?t=10805#p111333

Highlighting

{{forum url|t=10805|hilit=board+index}}

https://forum.flightgear.org/viewtopic.php?t=10805&hilit=board+index

Highlight a post

{{forum url|p=111333|hilit=contains+a+problem}}

https://forum.flightgear.org/viewtopic.php?p=111333&hilit=contains+a+problem#p111333

User

{{forum url|u=2}}

https://forum.flightgear.org/memberlist.php?mode=viewprofile&u=2

Related templates