Difference between revisions of "Template:Bc"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
imported>DragoonWraith
(rv: experimentation went nowhere)
 
(6 intermediate revisions by the same user not shown)
Line 8: Line 8:
[[Category: Templates|Bc]]
[[Category: Templates|Bc]]
[[Category: Structural Templates|Bc]]
[[Category: Structural Templates|Bc]]
</noinclude><includeonly><div id="contentSub" style="position:absolute;top:{{#expr: 3.5+{{{row|1}}} }}em;"><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>{{#ifeq:{{{row|1}}}|1||<div id="contentSub"></div>}}</includeonly><noinclude>==Code==
</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>
<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:
The code is a bit of a mess, so here's the separate parts:

Latest revision as of 23:34, 8 August 2010

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>)