Lesson 2e: Building a Home Page

Now that you have three working pages—Folders.csp, Reports.csp, and Menu.csp—it is time to put them all together. Cut and paste the following into a new CSP file and save it as Home.csp. This file will define the frames for the home page.

Home.csp

To download the CSP files from this tutorial, click TutorialSamples.zip. For more information, see Code examples.

<% @language=JavaScript %>

<HTML>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

<link REL=STYLESHEET TYPE='text/css' HREF='tut.css'>

<FRAMESET Rows="64,*">

  

<!-- #include file=helper_js.csp -->

<%


  var CurrentFolderID;

  CurrentFolderID = Request.QueryString.Item("FolderID");

    

  //Load the top frame with menu.csp so that it can display the

  //full path to the current folder.

  

  Response.Write ("<FRAME Name='Header' Target='Contents' " +

             "Src='Menu.csp?FolderID=" + CurrentFolderID +" '>");

  Response.Write ("<FRAMESET Cols='180,*'>");


  // Load the folders portion of the page so that it can display

  // a list of sub-folders within the current folder.

  Response.Write ("<FRAME Name='Contents' Target='main' " +

         "Src='Folders.csp?FolderID=" + CurrentFolderID + "'>");


  // Load the reports portion of the page so that it can display

  // a list of the reports contained within the current folder.

  Response.Write ("<FRAME Name='Main'  Target='main'" +

         "Src='Reports.csp?FolderID=" + CurrentFolderID + "'>");


%>

  </FRAMESET>

  <BODY>

  </BODY>

</FRAMESET>

</HTML>


Remarks

Note that the source of the frame named Contents points to your Folders.csp file with the FolderID equal to the CurrentFolderID.

Response.Write ("<FRAME Name='Header' Target='Contents' " +

"Src='Menu.csp?FolderID=" + CurrentFolderID +" '>");

Also recall that earlier in the tutorial, in the section Redirecting the user to the site's home page, the Logon.csp page redirects the user to Home.csp, and that a particular line was unusual in that it included a question mark.

Response.Redirect ("Home.csp?FolderID=0");

The line loads the frames file with the parameter FolderID equal to zero. This ensures that when the page is first loaded, both the folders page and the reports page will load the folders and reports at the very top level of the folder tree.

Go to next step:

Saving and viewing the Tutorial Desktop



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com