I have an alphabetical site map divided into 26 pages.
Each page has a letter menu with links to the other pages.
Each page has a subject menu with links to bookmarks of the subjects on that page.
Each subject is followed by links (one per line) to all the articles on that subject.
The information for each article is held in a tab delimited flat file database (currently 1,300 records, 135KB, example record below). The database is loaded into a hash and traversed as shown in the pseudo code.
The resulting page looks like the pseudo page below.

It is a static web site updated up to 4 times a day. Rebuilding all the site maps every time is easier, in my opinion than trying to update them.

As it stands the body html is built tag by tag and then loaded into a template.
There are four loops each with various conditions (e.g. in the letter menu there is no link to the page you are on).
For me that is a significant amount of logic and I would like all of it to be in the script.

I have looked at HTML::Template and believe that although it could be used I'm afraid it would be very difficult to maintain.

How would other monks approach this task?

------------------------------------ pseudo code ------------------------------------ foreach letter ('a'..'z') make letter menu # for loop 1 make subject menu # for loop 2 foreach subject (subjects){ # for loop 3 make subject header with bookmark foreach article (articles){ # for loop 4 make link to article } } make page } ------------------------------------ pseudo html page ------------------------------------ page a letter menu: a b c d e f etc. (links to other pages) subject menu: afghanistan africa asia etc. (links to subjects on this +page) afghanistan link to article one (newest first) link to article two link to article three etc. africa link to article four link to article five link to article six asia link to article seven link to article eight link to article nine subject menu (as above) letter menu (as above) ------------------------------------ record from database ------------------------------------ u Ukraine 20050122 ../2005/01/22ukraine.html Ukraine: 'Orange Revoluti +on' in Ukraine, 22 January 2005 (fields: letter, subject, date sort key, file, link text)

Updated: clarified pseudo code

In reply to Building html site maps by wfsp

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":