home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 95 / af095a.adf / archives / extras.lzx / WebSite / PageText / L04P02.txt < prev    next >
Encoding:
Text File  |  1997-01-18  |  2.4 KB  |  56 lines

  1. L04P02.txtTEXT’®öÆR®“ í<p>The ARexx script that builds this site uses a tree-based menu 
  2. definition in which, using an n.x.y=z type compound variable, x 
  3. represents the level in the menu tree, y represents the number of pages 
  4. present at that level, and z represents the number of descendents which 
  5. that page node has. The stem, n., is initialised to -1 to allow the 
  6. tree searching routines to recognise unused page nodes. For example...<p> 
  7.  
  8. <pre>
  9.         n.=-1
  10.  
  11.         n.0=4    /* 4 levels */
  12.  
  13.         n.1.1=10 /* this root page has ten descendant pages */
  14.                  /* in other words this page has ten menu options */
  15.                          
  16.         n.2.1=2  /* first page at second level has two descendant pages */
  17.         .        /* two menu options for this page! */
  18.         .
  19. </pre>
  20.  
  21. <p>With this definition available the required pages are generated
  22. using the following loop...
  23.  
  24. </p>
  25.  
  26. <pre>
  27.         do level = 1 to n.0        
  28.            page_start=0
  29.            say CountNodes(level) 'pages at level' level
  30.            do node=1 to CountNodes(level)
  31.               entries=n.level.node
  32.               call GeneratePage(level,node,page_start,entries)     
  33.               page_start=page_start+entries      
  34.            end
  35.         end
  36. </pre>
  37.  
  38. <p> This effectively carries out a level-by-level search of the menu tree. 
  39. Because, however, both level and page numbers are known during this loop
  40. it is possible for the GeneratePage() routine to automatically generate 
  41. a page name in the form LxPy.htm (where x is the level and y is the 
  42. page number). Similarly the names of the equivalent title and text 
  43. files (LxPy.title and LxPy.txt) can also be produced.</p>
  44. <p>In this way the page creation routine is able to use ARexx's Exists()
  45. function to check whether page title or page text files are available
  46. for each page being generated. If a file is found it is read in and used
  47. as appropriate. When such files are not found default page headings and
  48. menu entries are inserted instead. Date stamps files are similarly checked
  49. for and inserted into the final HTML file.
  50. </p>
  51.  
  52. <p><strong>Additional, and more detailed, explanations of how this is achieved 
  53. will be posted here in due course!</strong>
  54. </p>