TT2Site Builder

Template::TT2Site

A Template::Toolkit extension
Template::Toolkit
User guide » Menu creation


Most web sites use a menu to navigate. Template::TT2Site can automatically create this menu, using .map files placed in the directories to navigate. The advantage of .map files is that they can easily be maintained with the directory data, and directories can be moved to another location taking the map data with them.

This is how it works.

In your main directory (the one with the top level index.html in it, create a file .map with contents:

  title "Site Menu"
Now, for each entry you want in this menu, add a line:
  menu "Title" target

The item will appear in the menu as "Title".

The target for a menu choice is deducted as follows.

  • if a file target.html exists, the target is this HTML document;
  • if a directory target exists, the target will point to the index.html in this directory. If this directory contains a .map file, the navigation menu will be hierarchically expanded with the items from this directory, introducing a new level of navigation;
  • otherwise, target will be taken to be an arbitrary URL.

Note that the appearance of the actual menus is controlled by the layout definition of the web pages (file lib/page/layout) and the menu (file lib/page/menu).

The visual appearance can be controlled with the style sheet css/site.css. The menu items will belong to the CSS class 'menu', and the currently active link will be given the class 'menuselect'.



Powered by Template Toolkit

© Copyright 2004-2006 Squirrel Consultancy. All Rights Reserved.
Site design: Squirrel Consultancy using TT2Site.
userguide/menu.html last modified 21:07:50 14-Jan-2005