Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-26 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found