Help:Portals



From Nissan 350Z & 370Z Wiki

This page will be used in an attempt to explain the famous Portal layout on Wikipedia. There is little documentation on how to create these portals on other wikis, but they do have an explanation on how to make more Portals on Wikipedia. I will expand on their templates and try to explain what is being done and why.

The portals are made up of information blocks. Each block is constructed using templates containing several HTML div sections. Each block has a heading section that is usually colored to stand out. It will have the block title in it, as well as the "edit" link. Clicking the edit link should take you to the source of the content block. The heading block has an unclosed 'div' so that the content section will be wrapped inside this div and then closed by the footer template.

Things to cover:

  • Namespaces
  • Activation of "Tidy"
  • Example Usage
  • Required Templates

Namespaces

Wikipedia has included a custom namespace for their portals. All Wikipedia portals are located in the "Portal:" namespace. This is not a requirement, but I felt this was good practice and set it up on my wiki this way as well. You will need to give sub-page permissions to this namespace (or the namespace you choose). This is not completely necessary, but will make things easier as you follow these methods.

Tidy

Something that is not documented by Wikipedia, or anywhere else, is the use of tidy I do not understand the full effect of it, but I do know, that you will have to activate it for this template system to work. If you do not, the /box-header will automatically close the content div before you include the content.

You must create this file: /extensions/tidy/tidy.config

In this file paste this information:

# html tidy (http://tidy.sf.net) configuration
# tidy - validate, correct, and pretty-print HTML files
# see: man 1 tidy, http://tidy.sourceforge.net/docs/quickref.html

show-body-only: yes
force-output: yes
tidy-mark: no 
wrap: 0
wrap-attributes: no
literal-attributes: yes
output-xhtml: yes 
numeric-entities: yes
enclose-text: yes
enclose-block-text: yes
quiet: yes 
quote-nbsp: yes
fix-backslash: no
fix-uri: no

Finally, add this to LocalSettings.php:

$wgUseTidy = true;

Example Usage

There are several ways to fill content blocks on the portals. You can fill content using a sub-page of the portal, using a template, using another page in the wiki, or directly editing the portal page itself. Below are some examples of portal blocks being filled by these different methods.

The color of portal blocks is managed in the /box-header sub page of a portal. If you wanted to have uniform colors across your entire site, you could hard code this into the Template:Portal-header instead of using /box-header as the color specifiying template. If you want mulitple color sections on one page you can use additional header subpages and change the colors accordingly.

edit 

Subpages

This content is populated from a sub-page: Help:Portals/Subpages

If you click the Edit link in the heading above this content, you will be editing the subpage.

There will be a backlink (breadcrumb) to this portal page from the subpage after you edit.

edit 

Fullpages

edit 

Same Page

This content is added directly into the portal page.

Clicking the edit link on this block will let you edit this entire Portal page.

edit 

Color

This section is using a different header template to change the color. Help:Portals/box-header-2.

There can be infinite number of these headers, and they can be arranged in different ways.

What these mean

The content blocks are created with the following code on the actual portals. To start a content block use code:

{{/box-header|''Test''|{{FULLPAGENAME}}/Test|}}
{{{{FULLPAGENAME}}/Test}}
{{/box-footer|}}

This generates a block with empty content (see below). To fill the content, you will edit the /Test sub page.

edit 

Test


{{/box-header|''Test''|{{FULLPAGENAME}}/Test|}}

This makes the header section of the "Test" block. It calls on a sub page: /box-header, inputs the name of the block "Intro", and locates the page to edit for the intro section.

The /box-header template is used to change the colors of the blocks, and further calls on a template to establish the box layout using HTML 'divs': Portal:Box-header.

The Portal:Box-header establishes 2 div sections. The heading / edit section, and the content section. The content section however is left open in this template. There is no closing
to make the content block end. This allows us to pull the content from another page to fill the block and then close it in the /box-footer

{{{{FULLPAGENAME}}/Test}}

This is a template that is pulling all of the information from the sub-page /Test and putting it into the box. This part of the code is not necessary. You could alternatively hard code the text into the Portal page.

{{/box-footer|}}

This template closes the box. it simply closes the
content section opened initially by the /box-header. It also calls on another template "Poral:Box-footer

Templates

Below are the templates that you will need to copy to your wiki to make this portal system work.

Template:Portal-header

This template generates the Heading/Edit section of the portal blocks, and leaves an open 'div' for the content section of the portal block. There is no closing div tag in this template.

__NOEDITSECTION__ __NOTOC__<div style="clear: both;"></div> 
<div style="position: relative;<!--
         -->border: 1px solid {{{titleborder|{{{border|#ababab}}}}}};<!--
         -->background: {{{titlebackground|#bcbcbc}}};<!--
         -->color: {{{titleforeground|#000000}}};<!--
         -->padding: .1em;<!--
         -->text-align: center;<!--
         -->font-weight: bold;<!--
         -->font-size: 100%;<!--
         -->margin-bottom: 0px;<!--
         -->border-bottom: none;<!--
         -->-moz-border-radius-topleft:.7em;<!--
         -->-moz-border-radius-topright:.7em;"><!--
  --><span class="plainlinks" <!--
      -->style="position: absolute;<!--
             -->top: 1px;<!--
             -->right: 1px;<!--
             -->background: transparent;<!--
             -->border: 0px;<!--
             -->margin-bottom:0em;<!--
             -->font-size:80%;<!--
             -->font-weight: normal;"><!--
    -->[{{fullurl:{{{editpage|/}}}|action=edit}} <!--
    --><font color="{{{titleforeground}}}">edit</font>] <!--
  --></span ><!--
  --><h2 style="font-size:100%;font-weight:bold;border: none; margin: 0; padding:0; padding-bottom:.1em;"><!--
  --><font color="{{{titleforeground}}}">{{{title}}}</font></h2><!--
--></div>
<div style="display: block;<!--
         -->position: relative;<!--
         -->border: 1px solid {{{border|#ababab}}};<!--
         -->vertical-align: top;<!--
         -->background: {{{background|#fefeef}}};<!--
         -->color: {{{foreground|#000000}}};<!--
         -->margin-bottom: 10px;<!--
         -->padding: .3em;<!--
         -->margin-top: 0em;<!--
         -->padding-top: 0em;<!--
         -->-moz-border-radius-bottomleft:.7em;<!--
         -->-moz-border-radius-bottomright:.7em;"><!--
-->

Template:Portal-footer

This template will be used by Help:Portals/box-footer to close the content section as well as add a clearing so there is space between blocks.

<div class="noprint" style="text-align:right; margin:0.3em 0.2em 0.2em 0.3em; padding:0.3em 0.2em 0.2em 0.3em;">
<b>{{{1|}}}</b></div >
<div style="clear:both;"></div>
</div>