Defining the Site's Structure and Providing Site NavigationThe 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:
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
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. |