Site creation menu files

Previous page Next page

Menu description files

The menus used in the SourGumdrop web site were generated using the program make_menu. The program reads a simple text file, termed a "menu description file" which defines the content and structure of the menu and generates the corresponding XHTML.

An example menu description file (for Minestein) is shown in Figure 1, and the resulting XHTML in Figure 2. Each line of the menu description file encodes a menu item: the address and the title. For example:



minestein_3.html Options

defines the address as "minestein_3.html" and the title as "Options". So if the user clicks on the text "Options" in the menu, the browser will open page "minestein_3.html".

Within the XHTML, sections of a page can be given names. To jump to a named section, the address must include the name. For example:



minestein_3.html#logical_puzzles Logical puzzles

addresses logical_puzzles in file minestein_3.html.

In the menu description file the indentation defines the structure. The Minestein example shown in Figure 1., with only two levels, is very simple. A more complicated example is shown here where I reproduce the Stu Nicholls example which showed me how to code the menus used for this site.

minestein_1.html Introduction
 minestein_1.html#overview Overview
 minestein_1.html#what_is_minesweeper Minesweeper?
 minestein_1.html#news News
minestein_2.html Hints
 minestein_2.html#hint_algorithms Algorithms
 minestein_2.html#hint_alg_1 Algorithm 1
 minestein_2.html#hint_alg_2 Algorithm 2
minestein_3.html Options
 minestein_3.html#logical_puzzles Logical puzzles
 minestein_3.html#algorithm_choice Algorithm choice
 minestein_3.html#grid_size Grid size
 minestein_3.html#mine_count Mine count
 minestein_3.html#minimum_3bv Minimum 3BV
 minestein_3.html#generating_time Generating time
 minestein_3.html#random_seed Standard puzzles
minestein_4.html Controls
 minestein_4.html#exposing_a_mine Exposing a mine
minestein_7.html Game statistics
 minestein_7.html#results_file Results file
minestein_5.html Example game
 minestein_6.html Example game 2
Figure 1. The text file describing the Minestein menu.

The default file name for a menu description file is menu.txt.

<li class="drop"><a href="minestein_1.html">Introduction                       
<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]>
<table><tr><td><![endif]-->
<ul>                                                                                
<li><a href="minestein_1.html#overview" class="enclose">
Overview</a></li>           
<li><a href="minestein_1.html#what_is_minesweeper">
Minesweeper?</a></li>            
<li><a href="minestein_1.html#news">News</a></li>                                   
</ul>                                                                               
<!--[if lte IE 6]></td></tr></table></a><![endif]-->

</li>
<li class="drop"><a href="minestein_2.html">Hints
<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]>
<table><tr><td><![endif]-->
<ul>                                                                                
<li><a href="minestein_2.html#hint_algorithms" 
class="enclose">Algorithms</a></li>  
<li><a href="minestein_2.html#hint_alg_1">
Algorithm 1</a></li>                      
<li><a href="minestein_2.html#hint_alg_2">
Algorithm 2</a></li>                      
</ul>                                                                               
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>
<li class="drop"><a href="minestein_3.html">Options
<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]>
<table><tr><td><![endif]-->
<ul>                                                                                
<li><a href="minestein_3.html#logical_puzzles" 
class="enclose">Logical puzzles</a></li>
<li><a href="minestein_3.html#algorithm_choice">
Algorithm choice</a></li>
<li><a href="minestein_3.html#grid_size">Grid size</a></li>
<li><a href="minestein_3.html#mine_count">
Mine count</a></li>
<li><a href="minestein_3.html#minimum_3bv">
Minimum 3BV</a></li>
<li><a href="minestein_3.html#generating_time">
Generating time</a></li>
<li><a href="minestein_3.html#random_seed">
Standard puzzles</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->

</li>
<li class="drop"><a href="minestein_4.html">Controls
<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]>
<table><tr><td><![endif]-->
<ul>
<li><a href="minestein_4.html#exposing_a_mine">
Exposing a mine</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->

</li>
<li class="drop"><a href="minestein_7.html">Game statistics
<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]>
<table><tr><td><![endif]-->
<ul>
<li><a href="minestein_7.html#results_file">
Results file</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->

</li>
<li class="drop"><a href="minestein_5.html">Example game
<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]>
<table><tr><td><![endif]-->
<ul>
<li><a href="minestein_6.html">Example game 2</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>
Figure 2. The XHTML for the Minestein menu. Some lines have been folded so they fit across the narrow column. Note the contortions necessary to get versions of Internet Explorer to do the required thing.

Last updated: 2012-10-28    Sitemap