Emile van Bergen

About me

Software
   RADIUS for pppd
   i386 debugger
   HTML menus
   OpenRADIUS...

Technical articles
   Configuration data
   Non-recursive make
   Signals and Select
   Linux GUIs
      Library problems
      The GUI terminal

Work
   E-Advies...
   CV (NL, pdf)...
   Resume (pdf)...

Menu generator for static HTML pages


This website is in part automatically generated using two perl scripts that you see mentioned at the bottom of each page, decorate.pl and menuize.pl, glued together by a set of shell scripts, refresh.sh, e-advies/refresh.sh, and openradius/refresh.sh.

It makes maintaining a menu very easy, without having to resort to server-side includes, scripting or frames. Pages are cacheable and can be bookmarked.

Basically, you start out writing 'bare' HTML pages, without HTML, HEAD or BODY tags, such as you'll find in the source directory of this website, take for example the one for this page, src/html-menus.html. If you look at the source, you'll see you'll see some special comment tags:

<!-- DECO TITLE       = "Menu generator for static HTML pages"
          DESCRIPTION = "A set of Perl scripts to generate menus in HTML pages" 
          KEYWORDS    = "HTML, menu, static, generate, automatic" -->

<!-- MENU PARENT="Software" TITLE="HTML menus" URL="FILE" -->

Both pseudo-tags (DECO and MENU) allow certain attributes, just like real HTML tags.

The idea is that you feed pages with that information first through decorate.pl, which creates decorated but menuless pages in a temporary directory, like this one.

You see there the decorared page, without the <!-- DECO --> pseudo tags, but with the <!-- MENU --> ones still present. You'll also notice an <!-- INSERT_MENU -->, which is part of the template embedded in decorate.pl.

The last step is feeding the pages in the correct order through menuize.pl, which builds a tree-like menu from the PARENT and TITLE attributes of the MENU tags, and inserts the generated menu with the correct item selected in the place of <!-- INSERT_MENU -->, producing the final output.

See the shell scripts mentioned above on how to do this. The end result is a website such as this one.



Generated on Wed Aug 31 17:01:55 2005 by decorate.pl / menuize.pl