Campsite 2.3 User Guide

Campsite 2.3 User Guide

Select your language:  
    Search:   
<5.2.1. Modular Structure of Templates        5.2.3. Building an Article Template>

Print / Download:
Available languages: english Last update: 2005-10-12 08:07:56

5.2.2. Building a Navigation Template

As described above, the template structure can be nested, meaning one template can call another template. This, for example, makes a lot of sense for the navigation. To jump between sections, you might only need one navigation template that can be used by all other templates (article, section, home page).

To nest another template within another, use the following Campsite tag:

<!** include navigationtemplate.tpl>

The 'include' command is Campsite lingo; the name of the template needs to be adjusted to whatever you called it. Let's assume we add this tag in the article template we created earlier, and we can now go on and build the template.

First thing to do when you are building something like the navigation is to take control over the environmental variables. Our navigation needs to follow some standard rules and should not be affected too much by the environmental setting of the current position of the user.

In terms of Campsite lingo, we need to introduce a 'local' tag, which allows us to specify some environmental variables for a local section inside the template. In other words, we can switch off the environmental variables, set our own and then switch them on again. In that way we can use the same template for the navigation for all articles, sections, even issues (not publications, obviously).

In order to make sure you enter the current issue in the navigation bar, set the environment variables to:

<!** local><!** issue current>

Here, 'local' allows you to set the parameters inside a template to the values you want to be specified. Once the parser finds the 'endlocal' tag, it will switch back to the environment variables it arrived with (for example a back issue).

Then the issue parameter is set to 'current'. This is done in order to make sure that the navigation will always jump to the 'section' (or whatever you want) of the current issue.

Then you would need to specify which section you would want to link to. This is done with the 'section number' tag.

<!** section number 1>

The above tag would set the local section parameter to 1, which will be looked up in the Campsite database under section entries (each section is assigned a number when it is created, see section 2.2.3 of this manual).

Now we have set all necessary values for the link: we will link to section 1 in the current issue. All we need to do now is create the link to the section, or - to be more precise - the template that is used to build section pages.

<a href="<!** URI section>">NEWS</a>

This will create an ordinary link, using the anchor tag of HTML. This link will generate the URI for the section 1.

Finally, we need to end the local parameters with the tag:

<!** endlocal>

A complete navigation template could look like this:

<!** local><!** issue current><!** section number 1>
<a href="<!** URI section>">NEWS</a><br>
<!** endlocal>
<!** local><!** issue current><!** section number 2>
<a href="<!** URI section>">POLITICS</a><br>
<!** endlocal>
<!** local><!** issue current><!** section number 3>
<a href="<!** URI section>">SPORT</a><br>
<!** endlocal>
<!** local><!** issue current><!** section number 4>
<a href="<!** URI section>">CULTURE</a><br>
<!** endlocal>
<!** local><!** issue current><!** section number 5>
<a href="<!** URI section>">WEATHER</a><br>
<!** endlocal>

Make sure that the section numbers assigned correlate with the names of the sections, as you assigned them when building the publication in the first place.

Now we can advance into a more conditional environment, the section pages.


add a note add a note User Contributed Notes
5.2.2. Building a Navigation Template
Douglas Arellanes  douglas dot arellanes at mdlf dot org
Thursday 25th of August 2005 05:13:00 PM
You can also combine <!** if> statements inside these tags with the very useful FROMSTART command. This example checks to see which section the user is in, and then changes its style with a <SPAN> command.

<!-- NAV BAR -->

<div id="navtabs">

<!** local><!** issue current><!** section number 1>
<!** if section fromstart>
<span id="navtab_on">[<a href="<!** URI section>">SECTION 1</a>]</span>
<!** else>
[<a href="<!** URI section>">SECTION 1</a>]
<!** endif>
<!** endlocal>

<!** local><!** issue current><!** section number 2>
<!** if section fromstart>
<span id="navtab_on">[<a href="<!** URI section>">SECTION 2</a>]</span>
<!** else>[<a href="<!** URI section>">SECTION 2</a>]
<!** endif>
<!** endlocal>

<!** local><!** issue current><!** section number 3>
<!** if section fromstart>
<span id="navtab_on">[<a href="<!** URI section>">SECTION 3</a>]</span>
<!** else>
[<a href="<!** URI section>">BROCHURES</a>]<!** endif><!** endlocal>

<!** local><!** issue current><!** section number 4>
<!** if section fromstart><span id="navtab_on">[<a href="<!** URI section>">SECTION 4</a>]</span>
<!** else>
[<a href="<!** URI section>">SECTION 4</a>]
<!** endif>
<!** endlocal>


</div>

<5.2.1. Modular Structure of Templates 5.2.3. Building an Article Template>

  Last update: 2005-10-12 08:07:56
Website powered by Docmint Last update: 2005-10-12 08:07:56
Total page time: 1.49419212341