Chapter 25. Traversing Channels

Now that we've got context, we can begin to organize and exercise the assets in our Web Property. In this chapter we discuss one of the three primary hierarchies of CMS: the channel.

Hierarchies abound. They are used all around us to help us understand and interact with large, potentially complex groups of items. Grocery stores, department stores, hardware stores, stores of all kinds organize their wares hierarchically (see the Hierarchies in Our Lives sidebar).

Hierarchies in Our Lives

Hierarchies are used all around us. For example, grocery stores organize general areas of the store first by groups like produce, meats, refrigerated goods, frozen goods, dry goods, canned goods, bread, dairy, health, and beauty. Within each group, the store organizes products by labeled aisles of similar products, and within each aisle by product type. For instance, in the bread aisle we will find a section for white bread, another for wheat bread, another for rye and odd breads, still another for hot dog and hamburger buns, and perhaps even an area for day-old bread. Within each section, we will likely find different manufacturers and maybe even different sizes from the same manufacturer. This is done to help us quickly locate a given item within the vast array of items they offer.

Restaurants typically organize their menus hierarchically, first dividing the offered items by sections like appetizer, sandwich, meal, dessert, beverage, and bar. Then within a given section, like beverage, there may be groups like carbonated, coffee, milk, tea. Even within a given group, like milk, there may be further subdivision, like skim, 2%, and whole.

Perhaps the best example of a hierarchy is the military; a corps is made up of divisions, a division of brigades, a brigade of regiments, a regiment of battle groups, a battle group of battalions, a battalion of squadrons, a squadron of companies, a company of batteries, a battery of troops, a troop of platoons, a platoon of detachments, a detachment of sections, a section of squads, a squad of teams, a team of crews, and a crew is made up of various soldiers, airmen, and/or seamen. Within each of these is a specific hierarchical chain of command, and within that a separation of duties by specialty.

CMS capitalizes on the ubiquitous nature of this concept.

Many other hierarchy examples could be given (sports, your house, animals, government, religion, and transportation systems, to name a few), but to the point: Hierarchies do make it easier to understand and interact with the objects that they organize. One of the key hierarchies available in CMS is the channel. A CMS channel is used to organize, store, retrieve, and manage postings within our Web Property.

NOTE: In the next chapter, we explore postings at length. For now, think of a posting as a collection of information that we want someone to understand and potentially interact with.

In many ways a channel provides functionality similar to a virtual directory in a traditional Web site. It can be used not only to organize information but also to limit access to it. As with all hierarchies, there is one single, master RootChannel called Channels from which every other channel gets its genesis.

However, unlike a directory, Channel objects can have properties, can be easily sorted using multiple keys, can be moved or renamed in part or in whole without breaking links in the site, can be easily traversed both up (using the Parent Channel property) and down (using foreach on the contained Channel objects collection) the hierarchy, are typically used to generate dynamic navigation to their contents, and can even be deleted in code. In fact, all of this functionality is available from within the PAPI Context.

NOTE: The ability to move a channel (or a posting) to a new location without any broken links is a feature of CMS called Managed Links. Links are not stored in the database as links but instead as object references. Location is just a characteristic of the object. So, moving an object to a new location simply changes that characteristic, and any link reference will render to the current location.

All code in this chapter will refer to a posting based upon a template with the following ASP.NET Web Form controls TextBox, Label, ListBox, and Button using their default properties plus the default console, of course. Follow the steps in the Scratchpad sidebar, in Chapter 24, to re-create exactly the same results shown here, or use your own channels, templates, and postings and just apply the concepts. We will be repeatedly replacing the contents of the Button1_Click function.

Also, since we will be working with the channel hierarchy, it will be very helpful to have a structure to traverse. Figure 25-1 shows the structure of the potentially familiar hierarchy as viewed in the CMS Site Manager. This structure will be created later in this chapter in the Creating and Deleting Objects in a Channel section. The structure will be used with the other examples in this chapter.

Figure 25-1. Scratch channel hierarchy


NOTE: Using Site Manager to create channels is covered in depth in Chapter 9.

Initially, the only channel that has a posting in it is the Scratch channel.

Microsoft Content Management Server 2002. A Complete Guide
Microsoft Content Management Server 2002: A Complete Guide
ISBN: 0321194446
EAN: 2147483647
Year: 2003
Pages: 298 © 2008-2017.
If you may any questions please contact us: