Difference between revisions of "Template:Bc"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Qazaaq
(use small instead of font-size, easier to read)
imported>SnakeChomp
(Top margin is OK, expand bottom one.)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>Add <nowiki>{{Bc|Back Article|Hyperlink Text}}</nowiki> to the top line of an article to add a breadcrumb back to the previous article in a hierarchy.
<noinclude>Add <nowiki>{{Bc|Back Article|Hyperlink Text|Back Article 2|Hyperlink Text 2|Back Article 3| Hyperlink Text 3|Back Article 4|Hyperlink Text 4}}</nowiki> to the top line of an article to add a breadcrumb back to the previous article in a hierarchy.


* Back Article is the title of the article that is above the current one in the hierarchy.
* Back Article is the title of the article that is above the current one in the hierarchy.
* Hyperlink Text is what the link should read. May be omitted, and the article title (sans Namespace) will be used instead.
* Hyperlink Text is what the link should read. May be omitted, and the article title (sans Namespace) will be used instead.
* If <nowiki>{{Bc}}</nowiki> is used without either parameter, it defaults to the Main Page of the current Namespace.
* If <nowiki>{{Bc}}</nowiki> is used without either parameter, it defaults to the Main Page of the current Namespace.
* Multiple <nowiki>{{Bc}}</nowiki> tags can be added on subsequent lines, but keep them all in the first X lines.
* Multiple pages can be called.


[[Category: Templates|Bc]]
[[Category: Templates|Bc]]
[[Category: Structural Templates|Bc]]
[[Category: Structural Templates|Bc]]
</noinclude><includeonly><div style="margin: -0.5em 0.5em 0.5em -0.5em;"><small>[[:{{NAMESPACE}}:{{{1|Main Page}}}|< back to {{{2|{{{1|Main Page}}}}}}]]</small></div></includeonly>
</noinclude><includeonly><div id="contentSub" style="margin-top: -1em; margin-bottom: 1em"><span class="subpages">&lt; [[:{{NAMESPACE}}:{{{1|Main Page}}}|{{ #if: {{{2|}}}|{{{2}}}|{{{1|Main Page}}} }}]] {{ #if: {{{3|}}}|&lt; [[:{{NAMESPACE}}:{{{3|Main Page}}}|{{ #if: {{{4|}}}|{{{4}}}|{{{3|Main Page}}} }}]] }} {{ #if: {{{5|}}}|&lt; [[:{{NAMESPACE}}:{{{5|Main Page}}}|{{ #if: {{{6|}}}|{{{6}}}|{{{5|Main Page}}} }}]] }} {{ #if: {{{7|}}}|&lt; [[:{{NAMESPACE}}:{{{7|Main Page}}}|{{ #if: {{{8|}}}|{{{8}}}|{{{7|Main Page}}} }}]] }}</span></div></includeonly><noinclude>==Code==
<pre><div id="contentSub"><span class="subpages">&lt; [[:{{NAMESPACE}}:{{{1|Main Page}}}|{{ #if: {{{2|}}}|{{{2}}}|{{{1|Main Page}}} }}]] {{ #if: {{{3|}}}|&lt; [[:{{NAMESPACE}}:{{{3|Main Page}}}|{{ #if: {{{4|}}}|{{{4}}}|{{{3|Main Page}}} }}]] }} {{ #if: {{{5|}}}|&lt; [[:{{NAMESPACE}}:{{{5|Main Page}}}|{{ #if: {{{6|}}}|{{{6}}}|{{{5|Main Page}}} }}]] }} {{ #if: {{{7|}}}|&lt; [[:{{NAMESPACE}}:{{{7|Main Page}}}|{{ #if: {{{8|}}}|{{{8}}}|{{{7|Main Page}}} }}]] }}</span></div></pre>
The code is a bit of a mess, so here's the separate parts:
*<nowiki><div id="contentSub"><span class="subpages"></nowiki>
**Formatting
*<nowiki>[[:{{NAMESPACE}}:{{{1|Main Page}}}|{{ #if: {{{2|}}}|{{{2}}}|{{{1|Main Page}}} }}]]</nowiki>
**This is the first link and hypertext
**<nowiki>:{{NAMESPACE}}:{{{1|Main Page}}}</nowiki>
***Link to first parameter, or '''Main Page''' if first parameter is undefined
**<nowiki>{{ #if: {{{2|}}}|{{{2}}}|{{{1|Main Page}}} }}</nowiki>
***Hypertext - uses 2nd parameter if defined, 1st if 2nd is undefined or empty and 1st parameter is defined, '''Main Page''' if neither 1st or 2nd parameter is defined
****Note that the test for the '''If''' statement includes a default empty string - this is because an undefined parameter would return true and only empty strings return false (see [http://en.wikipedia.org/wiki/Help:Template#Parameters this page] for the trick)
*" "
**Space for the next carot
*<nowiki>{{ #if: {{{3|}}}|< [[...]]}}</nowiki>
**If there is a third parameter, then render the link and hypertext of the 2nd Back Article
*"< "
**Note that this isn't " < " - the space before the carot doesn't show up (hence the space above)
*<nowiki>[[:{{NAMESPACE}}:{{{3|Main Page}}}|{{ #if: {{{4|}}}|{{{4}}}|{{{3|Main Page}}} }}]]</nowiki>
**The link and hypertext for the 2nd Back Article - breaks down like the first one
**<nowiki>:{{NAMESPACE}}:{{{3|Main Page}}}</nowiki>
***Link - note it uses the 3rd parameter instead of the 1st
**<nowiki>{{ #if: {{{4|}}}|{{{4}}}|{{{3|Main Page}}} }}</nowiki>
***Hypertext - note it uses the 3rd and 4th parameters instead of the 1st and 2nd
*Repeat for the each back articles
*Close up the formatting (<nowiki></span></div></nowiki>)
</noinclude>

Latest revision as of 16:22, 16 January 2009

Add {{Bc|Back Article|Hyperlink Text|Back Article 2|Hyperlink Text 2|Back Article 3| Hyperlink Text 3|Back Article 4|Hyperlink Text 4}} to the top line of an article to add a breadcrumb back to the previous article in a hierarchy.

  • Back Article is the title of the article that is above the current one in the hierarchy.
  • Hyperlink Text is what the link should read. May be omitted, and the article title (sans Namespace) will be used instead.
  • If {{Bc}} is used without either parameter, it defaults to the Main Page of the current Namespace.
  • Multiple pages can be called.

Code

<div id="contentSub"><span class="subpages">< [[:{{NAMESPACE}}:{{{1|Main Page}}}|{{ #if: {{{2|}}}|{{{2}}}|{{{1|Main Page}}} }}]] {{ #if: {{{3|}}}|< [[:{{NAMESPACE}}:{{{3|Main Page}}}|{{ #if: {{{4|}}}|{{{4}}}|{{{3|Main Page}}} }}]] }} {{ #if: {{{5|}}}|< [[:{{NAMESPACE}}:{{{5|Main Page}}}|{{ #if: {{{6|}}}|{{{6}}}|{{{5|Main Page}}} }}]] }} {{ #if: {{{7|}}}|< [[:{{NAMESPACE}}:{{{7|Main Page}}}|{{ #if: {{{8|}}}|{{{8}}}|{{{7|Main Page}}} }}]] }}</span></div>

The code is a bit of a mess, so here's the separate parts:

  • <div id="contentSub"><span class="subpages">
    • Formatting
  • [[:{{NAMESPACE}}:{{{1|Main Page}}}|{{ #if: {{{2|}}}|{{{2}}}|{{{1|Main Page}}} }}]]
    • This is the first link and hypertext
    • :{{NAMESPACE}}:{{{1|Main Page}}}
      • Link to first parameter, or Main Page if first parameter is undefined
    • {{ #if: {{{2|}}}|{{{2}}}|{{{1|Main Page}}} }}
      • Hypertext - uses 2nd parameter if defined, 1st if 2nd is undefined or empty and 1st parameter is defined, Main Page if neither 1st or 2nd parameter is defined
        • Note that the test for the If statement includes a default empty string - this is because an undefined parameter would return true and only empty strings return false (see this page for the trick)
  • " "
    • Space for the next carot
  • {{ #if: {{{3|}}}|< [[...]]}}
    • If there is a third parameter, then render the link and hypertext of the 2nd Back Article
  • "< "
    • Note that this isn't " < " - the space before the carot doesn't show up (hence the space above)
  • [[:{{NAMESPACE}}:{{{3|Main Page}}}|{{ #if: {{{4|}}}|{{{4}}}|{{{3|Main Page}}} }}]]
    • The link and hypertext for the 2nd Back Article - breaks down like the first one
    • :{{NAMESPACE}}:{{{3|Main Page}}}
      • Link - note it uses the 3rd parameter instead of the 1st
    • {{ #if: {{{4|}}}|{{{4}}}|{{{3|Main Page}}} }}
      • Hypertext - note it uses the 3rd and 4th parameters instead of the 1st and 2nd
  • Repeat for the each back articles
  • Close up the formatting (</span></div>)