O'Reilly logo

Embedding Perl in HTML with Mason by Ken Williams, Dave Rolsky

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Elements: the Building Blocks of Content

The core of the Bricolage interface is managing different types of assets through a workflow process. When you log in, Bricolage presents you with your own private workspace. Any story, media, or template assets that you have checked out are listed here (see Figure D-1), providing easy access for you to edit them, check them in, view their event logs, or delete them. You can also preview a story or media asset — see how it will look when it gets published — by clicking its title. You can sort the assets by many of their properties, including title, category, cover date, and priority. The navigation menu on the left side of the screen presents a hierarchical view of the workflows and administrative tools available for your use.

My Workspace

Figure D-1. My Workspace

Descending through the ADMIN ... PUBLISHING ... Elements menus presents the Bricolage Element Manager (Figure D-2). The Element Manager, like all of the Bricolage managers, provides an interface to search for existing elements for editing or deletion as well as a link to create new elements. Selecting to edit an element, such as the default-installed “Book Review” element, brings up the Element Profile (Figure D-3).

The Bricolage Element Manager

Figure D-2. The Bricolage Element Manager

The Book Review story type Element Profile

Figure D-3. The Book Review story type Element Profile

There are essentially three types of elements in Bricolage: those that define stories, those that define media assets, and subelements of either stories or media assets. The “Book Review” element shown in Figure D-3 is an example of an element that defines the structure of a story, hereafter called a “story type element.”

Figure D-3 reveals a multitude of relevant data points that describe stories based on this element. In the first section of the profile, the “Burner” select list determines what kind of template will be used to “burn” the content of “Book Review” stories into files. The options supported as of this writing are Mason and HTML::Template . This means that the templates that format the content of “Book Review” stories are actually Mason components! Other templating architectures may also be added by the time you read this, but isn’t it fortuitous that Bricolage already supports our favorite?

All story type and media type elements are set to publish to particular output channels. An output channel is a named collection of templates used to output the content of a story in a particular way. For example, in Figure D-3, notice that the “Book Review” story type element publishes to the “Web” output channel. Other output channels available to this element are “Email,” “Print,” and “WAP.” Should any of these be added to the “Book Review” element, upon publication a story built from the “Book Review” element will be formatted by templates specific to each output channel. In this way, it’s possible to publish the same content in multiple ways and to multiple destinations — a useful feature for maximizing the reach of your content. For example, adding the “WAP” output channel and publishing a story based on the “Book Review” element would format and distribute the content of the story for both the Web and for WAP phones. Bricolage allows you to create as many output channels as necessary to get your content where it needs to go. You’ll then just have to create the templates for them (see Section D.4 later in this chapter).

Examining sections 3, 4, and 5 of the Element Profile, you’ll notice that Bricolage provides for a great deal of element customization. Section 3, “EXISTING SUBELEMENTS,” lists subelements of the “Book Review” element. This list derives from all of the non-media type and non-story type elements in Bricolage. Furthermore, subelements can themselves contain subelements. In this way, one can create a structured hierarchy of elements, and this hierarchy can be as arbitrarily deep as necessary. In this example, “Page” and “Book Profile” have been added as subelements of the “Book Review” story type element. Thus, a content editor building a story based on the “Book Review” element will have a choice of adding page and book profile subelements. This componentized architecture closely mirrors Mason’s idea of assembling a page from a library of components — in fact, if you use the Mason burner, every element has a one-to-one relationship to a Mason component.

Sections 4 and 5 of the “Book Review” story type element profile illustrate Bricolage’s support for custom fields. As an element administrator, you determine what fields need to be in an element, the default order in which they appear, and whether they’re required or repeatable. Note that one field — Deck — has already been added. By using the form in section 5, you can add more fields and make them any of several familiar types: text box, radio button, checkbox, select list, and so on.

The key to element administration in Bricolage is to think of it in terms of logical data modeling. Think about how meaningful aggregations of content (e.g., stories or pages) on your site are structured, and then create the necessary elements and subelements to model those structures. Then, when content editors create the content, they’ll be presented with only the choices of elements and fields that adhere to the models you create for them. In this way, not only do you provide an intuitive interface for your content editors to work with, but you also assure the integrity of the resulting structure’s content.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required