ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Template:Sidebar: Difference between revisions

From ModEnc
Jump to navigation Jump to search
m Bah, burn you stupid bracket.
Morton (talk | contribs)
Fix unnecessary line breaks after template FOR REAL (source: https://stackoverflow.com/a/687082)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly><div class="NavFrame template_sidebar_wrapper" style="width: {{{width|20%}}}; float: {{{float|right}}};"><div class="NavHead template_sidebar_header"><div class="template_sidebar_headline">{{{title|{{PAGENAME}}}}}</div></div><div class="NavContent template_sidebar_content" style="display:{{#ifeq: {{{collapsed}}} | yes | none | block}};">{{{content|Sidebar/Default}}}</div></div></includeonly><noinclude>{{Sidebar|width=20%|float=right|title={{PAGENAME}}|content={{Sidebar/Default}}}}
<includeonly>
<div class="mw-collapsible template_sidebar_wrapper {{#ifeq: {{{collapsed}}} | yes | mw-collapsed }}" style="width: {{{width|20%}}}; float: {{{float|right}}}; padding: 4px; border: 1px solid #a2a9b1; text-align: center; font-size: 95%;">
<div class="template_sidebar_header" style="line-height: 1.6em; font-weight: bold; background-color: #ccf;">
<div class="template_sidebar_headline" style="margin: 0 4em;">{{{title|{{PAGENAME}}}}}
</div>
</div>
<div class="mw-collapsible-content template_sidebar_content" style="font-size: 100%;">{{{content|Sidebar/Default}}}
</div>
</div>
<nowiki /></includeonly><noinclude>
{{Sidebar|width=20%|float=right|title={{PAGENAME}}|content={{Sidebar/Default}}}}
This template serves as a unified wrapper for sidebars with a headline; see [[Template:Box]] for one without a headline. The purpose of this template is to unify the appearence of sidebars used on ModEnc, into which only the content is individually loaded. This way, the appearence of all sidebars can be changed quickly by either changing this template directly, or changing the CSS is calls.
This template serves as a unified wrapper for sidebars with a headline; see [[Template:Box]] for one without a headline. The purpose of this template is to unify the appearence of sidebars used on ModEnc, into which only the content is individually loaded. This way, the appearence of all sidebars can be changed quickly by either changing this template directly, or changing the CSS is calls.
==Usage==
==Usage==
<pre>{{Sidebar|width=|float=|title=|content=|collapsed=}}</pre>
<pre>{{Sidebar|width=|float=|title=|content=|collapsed=}}
</pre>
*'''width''' specifies the width of the sidebar - accepts both percentages and pixel lengths. Defaults to 20%.
*'''width''' specifies the width of the sidebar - accepts both percentages and pixel lengths. Defaults to 20%.
*'''float''' specifies whether the bar should float ''left'' or ''right'' of the text, or not at all (''none''). Defaults to right.
*'''float''' specifies whether the bar should float ''left'' or ''right'' of the text, or not at all (''none''). Defaults to right.
Line 9: Line 20:
*'''collapsed''' specifies whether this sidebar should be collapsed by default. Set yes if you want this, omit if you don't.
*'''collapsed''' specifies whether this sidebar should be collapsed by default. Set yes if you want this, omit if you don't.
==Example==
==Example==
<pre>{{Sidebar|width=20%|float=right|title={{PAGENAME}}|content={{Sidebar/Default}}}}</pre>
 
Is the code of the sidebar to the right. It only repeats the default values, so it is equal to just writing <nowiki>{{Sidebar}}</nowiki>. (Note that "Template:" of content is omitted because inclusion calls go to the template namespace by default.)
<pre>{{Sidebar|width=20%|float=right|title={{PAGENAME}}|content={{Sidebar/Default}}}}
</pre>
Is the code of the sidebar to the right. It only repeats the default values, so it is equal to just writing  
<nowiki>{{Sidebar}}
</nowiki>. (Note that "Template:" of content is omitted because inclusion calls go to the template namespace by default.)
==Notes==
==Notes==
*There are several pre-made Sidebars for situations like mod or tool information. Check [[ModEnc:Sidebars]] before you create a new one.
*There are several pre-made Sidebars for situations like mod or tool information. Check [[ModEnc:Sidebars]] before you create a new one.
*If you do create a new sidebar, ''do not copy this code''. Instead, nest templates. Have your template call this template with another template call in the content area.</noinclude>
*If you do create a new sidebar, ''do not copy this code''. Instead, nest templates. Have your template call this template with another template call in the content area.
</noinclude>

Latest revision as of 19:57, 25 July 2023


Sidebar
There was no content specified for this sidebar!
Please edit this page again and add the content= flag to your template call!
(This is the default message for the sidebar template.)

This template serves as a unified wrapper for sidebars with a headline; see Template:Box for one without a headline. The purpose of this template is to unify the appearence of sidebars used on ModEnc, into which only the content is individually loaded. This way, the appearence of all sidebars can be changed quickly by either changing this template directly, or changing the CSS is calls.

Usage

{{Sidebar|width=|float=|title=|content=|collapsed=}}
  • width specifies the width of the sidebar - accepts both percentages and pixel lengths. Defaults to 20%.
  • float specifies whether the bar should float left or right of the text, or not at all (none). Defaults to right.
  • title specifies the headline at the top of the sidebar. Defaults to the name of the page it is included into.
  • content specifies the content of the sidebar - this should be an inclusion-call with the name of the page that provides the content of the sidebar. The name has to include the target page's namespace and has to be enclosed in curly brackets. At best, make the content page a sub-page of ModEnc:Sidebars. The default content is saved at Template:Sidebar/Default.
  • collapsed specifies whether this sidebar should be collapsed by default. Set yes if you want this, omit if you don't.

Example

{{Sidebar|width=20%|float=right|title={{PAGENAME}}|content={{Sidebar/Default}}}}

Is the code of the sidebar to the right. It only repeats the default values, so it is equal to just writing {{Sidebar}} . (Note that "Template:" of content is omitted because inclusion calls go to the template namespace by default.)

Notes

  • There are several pre-made Sidebars for situations like mod or tool information. Check ModEnc:Sidebars before you create a new one.
  • If you do create a new sidebar, do not copy this code. Instead, nest templates. Have your template call this template with another template call in the content area.