Site creation files

Previous page Next page

Files

The words and images displayed in a web page are encoded in "content files". The menu code in a web page can be quite complicated and the program make_menu is used to generate the code from a "menu description file". Page-specific keywords are added to web pages using a site-wide "keyword file". The names of the content files and their additional page-specific data are stored in "page description files". A particular directory structure is assumed by the program make_pages.

Content files

The content files are the ones which contain and define what will appear in the browser: the text and the pictures. They do not directly define the fonts, colours, layout, etc - that is done in the CSS - though they do say which style to apply to each section.

In the example page. the text from the content file is displayed in this colour.

Notice that for this typical page you only need to know how to create a heading, a paragraph, a figure legend and to refer to a picture. If you forget, do as I do and simply copy the code from an existing page.

Note that the files must be created and edited using a text editor NOT a wordprocessing program like OpenOffice or Word! For example, I use Emacs.

File names

The completed XHTML files are named after the user content files: user content file fred becomes fred.html. However there is a further important convention as is explained below.

File names for the two page styles

At present the site uses two types of page: double column pages and single column pages. Double column pages are prefered, but if I need to include a wide figure or table, I have to use a single column page. Obviously the declaration of the page type must appear somewhere in the code but I wanted to avoid it being included in the content files. So I've rather reluctantly used the convention explained below.

To produce a completed single column page named fred.html for display in the web site the content page must be named fred. To produce a double column page named fred.html, two content pages are required: the left hand column file named fredL and the right hand named fredR. In the example page the two segments of user written code are separated by 6 lines of code added by program. This convention avoids the user having to add these 6 lines and the 2 immediately preceeding the first section of user written code.

Page description files

The web pages in the SourGumdrop web site are generated using the imaginatively titled program make_pages. This program needs to know the names of the files to process and it also needs both site-specific data - say the name of the CSS file, and page-specific data for each page - say which picture to add to the banner. This information is supplied by a "page_description" file, which is a simple text file which names the files used to construct the pages and also contains the site and page-specific data. The default file name is pages.txt. The following items are included:

<file_name> 
user content file name and name of complete file

<page_title> 
page title to appear on the web page

<html_page_title> 
title for search engines and bookmarks (meta data "title")

<page_description> 
short page description (meta data "description")

<banner_file> 
name of banner file

<banner_alt> 
alternative text for banner

<banner_title> 
title for banner

<style_sheet> 
name of style sheet

<site_address> 
site address

Figure 1. The page_description record types.




Each page has records for: file_name, page_title, html_page_title, page_description, banner_file, banner_alt and banner_title. The banner data allows different images to be shown on the right hand side of the banner. There is also a single record with site_specific data which has records for style_sheet, site_address, banner_file, banner_alt and banner_title. In this case the banner information is use for the image on the left side of the banner. make_pages will exit with an error message if the format is not obeyed: each record type must be started and finished correctly: eg <file_name> must be closed with </file_name>. There is no significance in the order in which the records appear in the page_description files. Unnecessary items can be omitted.

In the example page text from the page_description file is shown in this colour.

An example file is shown in Figure 2.



<file>
<record>
<style_sheet>my_style.css</style_sheet>
<site_address>sourgumdrop.org.uk</site_address>
<banner_file>sg_game_source_pink.png</banner_file>
<banner_alt>SourGumdrop logo</banner_alt>
<banner_title>SourGumdrop logo</banner_title>
</record>


<file>
<record>
<file_name>minestein_1</file_name>
<page_title>Minestein Home</page_title>
<html_page_title>
Minestein: a Minesweeper game with logically solvable 
puzzles - no guessing is required
</html_page_title>
<page_description>
Minestein: a Minesweeper game with puzzles that can be 
solved by logic - no guessing is needed.
Puzzles can have a minimum difficulty. The Python source 
code is included in the download.
</page_description>
<banner_file>minestein.png</banner_file>
<banner_alt>Minestein logo</banner_alt>
<banner_title>Minestein logo</banner_title>
</record>

<record>
<file_name>minestein_2</file_name>
<page_title>Using hints</page_title>
<html_page_title>Minestein Using hints</html_page_title>
<page_description>Minestein's hints help users learn to 
play Minesweeper</page_description>
<banner_file>minestein.png</banner_file>
<banner_alt>Minestein logo</banner_alt>
<banner_title>Minestein logo</banner_title>
</record>

<record>
<file_name>minestein_4</file_name>  
<page_title>Toolbar and mines</page_title>
<html_page_title>Minestein Controls and mines
</html_page_title>
<page_description>Minestein's toolbar buttons: new game, 
hint, answers</page_description>
<banner_file>minestein.png</banner_file>
<banner_alt>Minestein logo</banner_alt>
<banner_title>Minestein logo</banner_title>
</record>

<record>
<file_name>minestein_3</file_name>  
<page_title>Options and configuration</page_title>
<html_page_title>Minestein Options and configuration
</html_page_title>
<page_description>Minestein's configuration: grid size, 
mine count, 3BV score</page_description>
<banner_file>minestein.png</banner_file>
<banner_alt>Minestein logo</banner_alt>
<banner_title>Minestein logo</banner_title>
</record>

<record>
<file_name>minestein_7</file_name>  
<page_title>Game statistics</page_title>
<html_page_title>Minestein Game statistics
</html_page_title>
<page_description>Minestein's statistics for minesweeper 
games</page_description>
<banner_file>minestein.png</banner_file>
<banner_alt>Minestein logo</banner_alt>
<banner_title>Minestein logo</banner_title>
</record>

<record>
<file_name>minestein_5</file_name>  
<page_title>Example game part 1</page_title>
<html_page_title>Minestein Example game part 1
</html_page_title>
<page_description>Minestein game explaining how to 
play Minesweeper</page_description>
<banner_file>minestein.png</banner_file>
<banner_alt>Minestein logo</banner_alt>
<banner_title>Minestein logo</banner_title>
</record>


<record>
<file_name>minestein_6</file_name>  
<page_title>Example game part 2</page_title>
<html_page_title>Minestein Example game part 2
</html_page_title>
<page_description>Minestein game explaining how to play 
Minesweeper</page_description>
<banner_file>minestein.png</banner_file>
<banner_alt>Minestein logo</banner_alt>
<banner_title>Minestein logo</banner_title>
</record>

</file>


Figure 2. The page_description file for Minestein. One record for each of the 7 pages and one for site-specific data.




Last updated: 2011-08-29    Sitemap