Template:Documentation/NavigationTemplate

From Apache OpenOffice Wiki
Revision as of 14:42, 30 July 2007 by Fpe (Talk | contribs)

Jump to: navigation, search

Template for book navigation

This template is a guideline for the Table of Contents navigation used for books on the OpenOffice.org Wiki.

A
</code> is used to divide up each section in the Table of Contents. The <code>style="display::none</code> option in the <code>
</code> is used to turn sections on and off. Each section is simply a bullet list of the Heading 1 levels, with the Heading 2 and deeper levels hidden by default.

To add a Table of Contents to a book in the OpenOffice.org Wiki:

  1. Create a new Wiki Template based on the title of the book or chapter.
  2. Copy the example template from this Template into your new template.
  3. Edit your new Table of Contents Template. You can add new subsections as needed. Make sure you wrap each subsection in a <code>
    </code>. Each subsection should have the display option set to <code>none</code>. This will hide the subsections.
  4. On each Wiki page in your book, add the code
{{{BookNavigationTemplateName|ChapterOrSectionName=block}}}
The <code>block</code> option is used to show a hidden section in the Table of Contents.

Example

You are adding a new book to the Wiki called My Big OOo Book. You start out a new Wiki page, and add some text content to it. You decide to add a chapter level Table of Contents to aid in navigation through the chapter (and through the book).

  1. Go to the top of the first Wiki page in your new chapter. Add a Template link:
    {{{MyOOoChapter1|Heading1=block}}}
    and save your edit.
  2. Click the new Link to MyOOoChapter that appears at the top of the page.
  3. Copy and paste the example template code into your new template.
  4. Edit the template code adding in:
    1. The chapter title.
    2. The heading 1 titles.
    3. The heading 2 and 3 levels in each chapter (as needed).

The result should look something like this:

<div id="PrevNext" style="margin-bottom: 10px; font-size: xx-small; height: 2em; display: {{{PrevNext|none}}}">
<div id="ExampleNavigationTemplatePrev" style="float:left;">[[{{{Prev}}}|< Previous Page]]</div>
<div id="ExampleNavigationTemplateNext" style="float:right;">[[{{{Next}}}|Next Page >]]</div>
</div>
<div id="tocwrapper" style="float:right; width: 200px; padding: 0px; border: 5px solid #fff; margin-left: 40px; margin-bottom: 20px;">
<div id="MyBigOOoBookChapter1" style="border:1px solid #666; padding: 2px; font-size: xx-small; background-color: #EEE;">
<div id="tochead" style="background-color: #FFF; padding: 2px;font-weight: bold; text-align: center;">[[Book Title]]</div>
<div id="tocbody" style="padding: 6px;">
[[Chapter title]]
<div id="Heading1" style="display:{{{Heading1|none}}};">
* [[Heading 1]]
* [[Heading 1]]
<div id="Heading2.1" style="display:{{{Heading2.1|none}}};margin-left: 12px;">
* [[Heading 2]]
* [[Heading 2]]
</div>
* [[Heading 1]]
* [[Heading 1]]
<div id="Heading2.2" style="display:{{{Heading2.2|none}}};margin-left: 12px;">
* [[Heading 2]]
* [[Heading 2]]
<div id="Heading3.1" style="display:{{{Heading3.1|none}}};margin-left: 12px;">
* [[Heading 3]]
* [[Heading 3]]
</div>
</div>
</div>
* [[Heading 1]]
* [[Heading 1]]
</div>
<div id="tocfoot" style="background-color: #FFF; padding: 2px;font-weight: bold; text-align: center;">
[[Previous Chapter Filename|← Previous Chapter]] — [[Next Chapter Filename|Next Chapter →]]
</div>
</div>
</div>

Save the changes and go back to the first page of your Wiki Book. The link you had originally should have changed to a Table of Contents menu on the right hand side of the Wiki page. You should see the chapter title, and the heading 1 levels for the current chapter.

On each page of your chapter, you add the link to the Template. Make sure you change the <code>block</code> option for each page you add so that the correct part of the Table of Contents is shown for the page you are on in the Wiki book. The link to Chapter 1 Heading 1 coule look like this:

{{{MyOOoBook|Chapter1=block}}}

The link to Chapter 1 Heading 2 could look like this:

{{{MyOOoBook|Chapter1=block|Chapter1Level2=block}}}

This will show the heading 1 and heading 2 levels. These levels are hidden until you pass the <code>Chapter1Level2=block</code> option to the Template.

Note: The Wiki title for this example template would be <code>Template:MyOOoBook</code>.

Screen capture showing the TOC in a document

This screen capture shows how the TOC concept can be implemented in a large document.

Example showing how the TOC can be implemented in a Wiki book

Views
Personal tools
Navigation
Tools