Adding Placeholder Definitions to Your TGI

One of the unique elements in all the templates you create will be the template's placeholders. As you inventory your content and analyze the various page types, you should really study the content itself not just the layout, but the content types (text, images, files) and what attributes are applied to the content (bold, tables, hyperlinks). As content contributors add content to the site, they are actually adding that content to placeholders defined in the TGI. As you study the content, you should be thinking about what kinds of placeholders you'll need in each template that you develop.

As we mentioned, the TGI contains the definitions for all the placeholders in the template. As you create your placeholder definitions, you'll have to decide what kinds of content each placeholder will store and what flexibility that placeholder will allow the content contributor. By flexibility, we mean what kinds of formatting they can apply, as well as what types of content can be contributed to the placeholder itself. For example, Figure 10-9 depicts a press release in the BOTS Consulting Web site. You'll notice that there are primarily two text elements to the release: the body copy and the call-out text. Scanning further, you'll notice that the release does not have any special attributes or HTML constructs (such as tables). In other words, the text is primarily a plain Verdana font with bold applied only in certain areas. From this example, we can gather that we may only need two placeholders, and those placeholders will only need to allow plain text and bold.

Figure 10-9. A BOTS Consulting press release


Now, if we were to try to create a TGI to match the format and layout of this page, we would have to create placeholders that fit the descriptions we just provided. In Figure 10-10, you'll see the Properties view of a TGI. The Properties view allows you to change the various elements of a TGI, including the custom property and placeholder definitions, as well as which ASPX page is tied to this TGI. To see the properties of any TGI, simply click the TGI in the Template Explorer view.

Figure 10-10. TGI Properties view in VS.NET


In your TGI Properties view, locate the Placeholder Definitions property. This property allows you to get to the designer, where you can define the various placeholder definitions your template will have. Very much as a TGI is the definition of a template and ultimately ties back to an ASPX page, a placeholder definition is the metadata about a placeholder. Once this information is defined, you can then bind a placeholder control within the ASPX file to the definition in the TGI. To create a new placeholder definition, click the Placeholder Definitions property. Then click the ellipsis that appears. Figure 10-11 shows this operation.

Figure 10-11. You click the ellipsis to define your placeholders.


Once you've clicked the ellipsis, you get the Placeholder Definition Collection Editor, shown in Figure 10-12.

Figure 10-12. The Placeholder Definition Collection Editor


The Placeholder Definition Collection Editor allows you to create the various placeholder definitions for your template. Native to CMS are six distinct definitions, each providing varying functionality and property sets. The six types are:

  • HTML

  • XML

  • Attachment

  • Image

  • Office attachment

  • Office HTML

When a placeholder control is bound, the definition controls not only the look of the placeholder, but the kind of content that placeholder will accept. We'll discuss each of these placeholders in more depth in Chapter 13. For now, it's important to understand that each of these placeholder types will play a specific role in your templates.

To add a new placeholder definition to your TGI, simply click the Add button in the lower left. Once you've clicked Add, CMS will, by default, add an HTML placeholder definition (if you click the down arrow next to the Add button, you can choose a different placeholder type). Looking immediately to the right of the new definition, you'll see its properties. We'll learn more about each of the properties in Chapter 13 as we discuss placeholders in more depth. However, the complete placeholder definition collection for the BOTS Consulting press release template is shown in Figure 10-13. You'll notice that there are more placeholders in the definition collection than we discussed earlier. As it turns out, the press release could contain content other than what we originally identified. As a result, the BOTS IS/IT department decided to add additional placeholders so that content contributors would have more flexibility in the type of content they could contribute.

Figure 10-13. The BOTS Consulting press release placeholder definitions


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: