Defining the Site s Structure and Providing Site Navigation


Defining the Site's Structure and Providing Site Navigation

The final piece for our online photo album application is defining the site map. As we discussed in Hour 19, "Defining a Site's Structure and Providing Site Navigation," a website's structure can be defined using a site map, which is a static, XML-formatted file.

The static, XML-formatted file approach works well for sites whose site structure is predefined. However, with dynamic sites, the site's structure is more fluid. For example, the photo album application's structure includes several static pagesthe home page, the login page, the photo administration page, and so onbut also includes dynamic pages, such as the photo album for a particular user or the comments page for a particular picture.

For dynamic websites like ours, the site map functionality can be customized by using a custom site map provider. Unfortunately, an exploration of this topic is beyond the scope of this book. Therefore, we will be creating a rather simple, static site map, one that does not include user-specific photo albums or pictures. If you are interested in implementing a dynamic site map through the use of a custom site map provider, check out my article, "Examining ASP.NET 2.0's Site Navigation," which begins at http://aspnet.4guysfromrolla.com/articles/111605-1.aspx.

The photo album application's site map is rather scant, having only five entries:

  • Home The site's home page, Default.aspx

  • Photo Album Administration The main photo album administration page, PhotoAdmin/Default.aspx

  • Manage Categories The manage categories page, PhotoAdmin/ManageCategories.aspx

  • Create an Account The create an account page, CreateAccount.aspx

  • Login The site's login page, Login.aspx

The two pages whose content is dynamically determined based on the querystring valuesPhotoAlbum.aspx and PhotoDetail.aspxare not included in the site map due to their dynamic nature. Listing 24.4 contains the site map's content.

Listing 24.4. The Site Map Has an Entry for Each of the Four Static Pages

[View full width]

 1: <?xml version="1.0" encoding="utf-8" ?>  2: <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >  3:     <siteMapNode url="~/Default.aspx" title="Home">  4:         <siteMapNode url="~/PhotoAdmin/Default.aspx" title="Photo Album Administration">  5:           <siteMapNode url="~/PhotoAdmin/ManageCategories.aspx" title="Manage  Categories" /> 6:         </siteMapNode>  7:         <siteMapNode url="~/CreateAccount.aspx" title="Create an Account" />  8:         <siteMapNode url="~/Login.aspx" title="Login" />  9:     </siteMapNode> 10: </siteMap> 

With the site map file created, the final step is to implement the site navigation user interface. Return to the master page and add a SiteMapPath control.

Figure 24.23 shows the Login page after the SiteMapPath control has been added. As you can see in the upper-left corner of the page, the SiteMapPath displays a breadcrumb based on the page being visited.

Figure 24.23. A SiteMapPath control has been added to the master page.





Sams Teach Yourself ASP. NET 2.0 in 24 Hours, Complete Starter Kit
Sams Teach Yourself ASP.NET 2.0 in 24 Hours, Complete Starter Kit
ISBN: 0672327384
EAN: 2147483647
Year: 2004
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net