Dynamic-CD
Search : 
  Powered by FindinSite

• Examples home
• Getting started
• Automated encryption
• Compare ASP servers
• Cookies test centre
• Database browser
• Menuing system
• Office Web Components
• Searching CDs
• SecureCD
• Shopping cart
• Slide show
• Sync demo
• Timed passwords
• User entry control

• ASP support
• Database CDs
• Evaluation download

• Case studies
• Examples
• FAQ
• Features
• License and pricing
• What they say
    
Example of a Menuing System

Dynamic-CD uses a dynamic menuing system so that each web page has an appropriate menu displayed on the left hand side.

Many Dynamic-CD pages share the same left-hand menu. Instead of duplicating the same code for each page, the menu is inserted as a Server-Side Include (SSI) file as shown below :


<!-- #INCLUDE FILE="menu.inc" -->
The menu is dynamic : Dynamic-CD processes the SSI and highlights the current page. On the left, for example, the item " Menuing system" is highlighted. The link to the current page is also removed.
menu.inc

<%
' ----------------------------
' PICK UP THE URL OF THIS PAGE
' ----------------------------
thisURL = Request.ServerVariables( "URL")

' ---------------------------
' DECIDE HOW TO DISPLAY
' ---------------------------
SUB menuItem( href, hrefText)

' get URL filename
  urlFile = "???"
  slashAt = InStrRev( thisURL, "/")
  if slashAt > 0 then
    urlFile = mid( thisURL, slashAt+1)
  end if

' compare URLfile with hrefFile
  cmpStr = href
  if len( href) > len( urlFile) then
    cmpStr = mid( href, len( href) - len( urlFile))
  end if

  if urlFile = cmpStr then
    Response.Write "<B><FONT COLOR=green>" + hrefText &_
      "</FONT></B><br>"
  else
    Response.Write "<A HREF=" + href + ">" + hrefText &_
      "</A><br>"
  end if
END SUB

' ---------------------------
' CREATE THE MENU ITEM
' ---------------------------
call menuItem( "menuSyst.asp", "Menuing system")

%>

The code for the Dynamic-CD menuing system can be found in the ????menu.asp files in the Dynamic-CD release directories.

See also the discussion on Server-Side Includes in the documentation.


© Copyright 2000-2007 PHD Computer Consultants Ltd