Willy's
Freeware

 Windows 95...XP
 Agenda 
 Belgian postal codes 
 Calculator 
 Htmlpad 
 Links2Tray 
 Startup manager 
 Excel 97...2007
 Alphabetical Disorder 
 Customize the Ribbon 
 Perpetual calendar 
 DOS
 Compaction manager 
 GPS
 MTB tracks 
 Fietsroutetracks 
 Fietsknooppunten 
 Other
 Download 
 How this site is setup 
 Index 
 Home 

Top


Simplicity is
the characteristic
of the real thing.


How this web site is setup

As you can tell by the .asp extension of the URL's, this site uses Active Server Pages (ASP). This means that when you require a page, the server assembles it on the spot and sends the result to your browser. For better understanding of this page, some knowledge of ASP and Visual Basic scripting is required.
The basic layout of each
page is a four cells table:


menu
Page contents






footerfooter

            All pages have the
following structure:

<!--#include file="menu.asp"-->

The page contents...

<!--#include file="footer.asp"-->

(see for example the
source of Agenda.asp)

The menu is the same for each page and appears in the upper left cell of the table (vertical layout). So the contents of this cell being the same for each page, it can be put in a separate file: menu.asp. This is then inserted in each page.

The menu.asp file (view source) is inserted at the top of each page with <!--#include file="menu.asp"-->. It starts creating the basic layout table, that is the same for all pages, and builds the menu.

The footer.asp file (view source) is inserted at the end of each page with <!--#include file="footer.asp"-->. It finishes the basic layout table.

When I want to change the menu, I only have to edit it once in menu.asp and the changes are automatically reflected on every page.

Although the menu is the same for each page, it is best that the menu item of the current page isn't a hyperlink (which would be to itself). That way you cannot click on it by mistake causing only a useless reload of the page. It is also nice to give it a different background color so you can tell which page is current .To do both, the menu is build up dynamically with a Visual Basic script.

The name of each page appearing in the menu is placed in the array mnu and the corresponding file base name in the array file. The menu is built up by a For ... Next loop that runs for every menu item:

<%
file=Array("Agenda","Post","Calculator","Htmlpad","Links2tray","Startup",_
	"Kalender","Cm","Download","Sitesetup","Links","Home")
mnu=Array("Agenda","Belgian postal codes","Calculator","Htmlpad","Links2Tray",_
	"Startup manager","Perpetual calendar","Compaction manager",_
	"Download","How this site is setup","Interesting links","Home")
ma=Array(" class=col3","")
For X=0 To Ubound(mnu)
   Select Case X
      Case 6 Response.Write "<TR><TD class='b col4'> For Excel 97</TD></TR>"
      Case 7 Response.Write "<TR><TD class='b col4'> For DOS</TD></TR>"
      Case 8 Response.Write "<TR><TD class='b col4'> Other</TD></TR>"
   End Select
   Y=StrComp(ThisPage,file(X),1) 
   If Y Then
      Z="<A class=M target=_top href="&slash&file(X)&".asp"&"> "&mnu(X)&" </A>"
   Else
      Z="&nbsp;"&mnu(X)&"&nbsp;"
   End If
   Response.Write "<TR><TD"&ma(Abs(Y))&"><SMALL>"&Z&"</TD></TR>"
Next
%>
Select Case inserts the titles at the appropriate places.
Then the plain menu name in mnu(X) is changed into a hyperlink except for the current page.

StrComp compares ThisPage, being the base name of the current page, with the string value in file(X). When not equal, meaning the menu item being processed is not the current page, the menu item mnu(X) is embedded within the appropriate <A href=...> ... </A> tags making it a clickable link. If the currently processed menu item is the one of the current page, this embedding is skipped and the menu item mnu(X) remains unchanged (except for the non braking space to the left and right which act a small margin).

Response.Write "<TR><TD"&ma(Abs(Y))&"><SMALL>"&Z&"</TD></TR>" inserts the menu item embedded within the appropriate cell tags. ma(Abs(Y)) inserts a different cell background color for the active page.

The menu is made floatable, so it stays always visible when scrolling the page, by using a Java Script by Roy Wittle.

                 
Statistieken