Difference between revisions of "Template:Documentation/NavigationTemplate"

From Apache OpenOffice Wiki
Jump to: navigation, search
Line 78: Line 78:
 
<pre>{{{MyOOoBook|Chapter1Level2=block}}}</pre>
 
<pre>{{{MyOOoBook|Chapter1Level2=block}}}</pre>
 
This will show the heading 2 levels.  These levels are hidden until you pass the '''Chapter1Level2=block''' option to the Template.
 
This will show the heading 2 levels.  These levels are hidden until you pass the '''Chapter1Level2=block''' option to the Template.
 +
 +
'''Note:''' The Wiki title for your template is '''Template:MyOOoBook'''.

Revision as of 08:47, 16 April 2007

Template for book navigation

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

A <div> is used to divide up each section in the Table of Contents. The style="display::[[Chapter|none]] option in the <div> is used to turn sections on and off. Each section is simply a bullet list of the book Chapters, with the Heading 1 and Heading 2 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.
  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 <div>. Each subsection should have the display option set to none. This will hide the subsections.
  4. On each Wiki page in your book, add the code
{{{BookNavigationTemplateName|ChapterOrSectionName=block}}}
The block 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 OOo Book. You start out a new Wiki page, and add some text content to it. You decide to add a book Table of Contents to aid in navigation through your book.

  1. Go to the top of the first Wiki page in your book. Add a Template link:
    {{{MyOOoBook|Chapter1=block}}}
    and save your edit.
  2. Click the new Link to MyOOoBook 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 book title.
    2. The chapter titles.
    3. The heading 1 and 2 levels in each chapter (as needed).

The result should look something like this:

<div id="DevGuide" style="float: right; border:1px solid #666; max-width: 200px; padding: 2px; font-size: xx-small; background-color: #EEE;">
<div id="tochead" style="background-color: #FFF; padding: 2px;font-weight: bold; text-align: center;">[[My OOo Book]]</div>
<div id="tocbody" style="padding: 6px;">
* [[Chapter 1]]
<div id="Chapter1" style="display:{{{Chapter1|none}}};margin-left: 15px;">
* [[Heading 1.1]]
* [[Heading 1.2]]
<div id=Chapter1Level2a" style="display:{{{Chapter1Level2|none}}};margin-left: 15px;">
* [[Heading 2.1]]
* [[Heading 2.2]]
</div>
* [[Heading 1.3]]
* [[Heading 1.4]]
</div>
* [[Chapter 2]]
<div id="Chapter2" style="display:{{{Chapter2|none}}};margin-left: 15px;">
* [[Heading 2.1]]
* [[Heading 2.2]]
</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 titles, and the headings for the current chapter.

On each page of your book, you add the link to the Template. Make sure you change the block 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 should look like this:

{{{MyOOoBook|Chapter1=block}}}

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

{{{MyOOoBook|Chapter1Level2=block}}}

This will show the heading 2 levels. These levels are hidden until you pass the Chapter1Level2=block option to the Template.

Note: The Wiki title for your template is Template:MyOOoBook.

Personal tools