Part 3

NEWS & TIPS

  • Site Access Keys
  • Top: Alt+t
    Previous: Alt+,
    Next: Alt+.
    Up: Alt+;
    (Note: use Ctrl on the Mac)

Display Recent Press Releases


A common use of the system is to show the most recent press releases issued on a site. The demo site doesn’t have a press releases section, but we’ll go ahead and create a temporary example walking through the process. The first step is to set up an index block of the press releases folder.

A. Create an Index Block of Press Releases

To create an index block of press releases:

  1. First create the press releases folder (refer to Technical Intro Part 1 on How to Create a New Folder). In our case, we will create /web/press-releases.
  2. Browse to your index blocks folder. In our case, we will browse to /web/blocks/index.
  3. Click on New -> Default -> Block in the top navigation menu.
  4. Select the Index Block radio button, and click Submit.
  5. For the Index Folder field, browse to your press releases folder. In our case, we will choose /web/press-releases. Click Confirm to approve the selection.
  6. For the Depth of Index, type in 1.
  7. For the Index Asset Types, check the box for Pages.
  8. For the Index Asset Content, check the boxes for Regular Content and User Metadata.
  9. Now go to the System pane. For the System Name field, type in press releases.
  10. Click Submit to save the new press releases index block.
  11. The new index block won’t have any content if there aren’t any pages in the designated folder. Copy several pages into your press releases folder. In our case, we will copy /web/about and /web/agents into /web/press-releases. Note that pages used in an index block need to have the option Include when indexing turned on in the respective page system menu choices, otherwise they won’t show up in the index blocks.
  12. With the pages copied in, navigate back to your press releases index block. In our case, we will navigate to /web/blocks/index/press releases. You should now see the page metadata in the XML preview.

B. Create a Recent Press Releases Stylesheet

Now that the index block and the pages are in place, you need to create a new XSL in order to transform the XML into our desired snippet of HTML.

To create a recent press releases stylesheet:

  1. Browse to your stylesheets folder. In our case, we will browse to /web/stylesheets.
  2. Click on New -> Default -> Stylesheet in the top navigation menu.
  3. For the XML field, type in the following:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:output method="xml" indent="yes" />
       <xsl:template match="system-index-block">
          <div><h2>Recent Press Releases</h2>
            <xsl:apply-templates select="system-page" />
          </div>
       </xsl:template>
       <xsl:template match="system-page">
          <xsl:if test="position() &lt; 5 and name != 'index'">
             <p>
                <a>
                   <xsl:attribute name="href">
                      <xsl:value-of select="path" />
                   </xsl:attribute>
                   <xsl:value-of select="title" />
                </a><br />
                <xsl:value-of select="summary" />
             </p>
          </xsl:if>
       </xsl:template>
    </xsl:stylesheet>
    The stylesheet outputs a heading, saying recent press releases, and then matches all of the system pages. If the page is one of the first four in the folder, according to the folder positioning, and isn’t the index, then a link is created to the press release with the title metadata value and then the summary metadata value is shown below.
  4. Click on the System pane; and for the System Name field, type in recent press releases.
  5. Click on the Submit button to save the new stylesheet.

C. Override a Region at the Page Level

Now that you have your press releases index block and stylesheet, you need to plug them in to a page region. You are going to override the context navigation region specified by the configuration set with your recent press releases.

To override a region block and stylesheet at the page level:

  1. Browse to the desired page. In our case, we will choose /web/index.
  2. Click the Edit tab.
  3. Select the Configurations pane in order to see the existing configurations.  Because HTML is the default configuration, it will already be shown in the pane along with all available regions and any current assignments.
  4. Click the browse icon for the CONTEXT-NAVIGATION Block, and select your new press releases index block. In our case, we will select /web/blocks/index/press releases.
  5. Now click the browse icon for the CONTEXT-NAVIGATION Stylesheet, and select your new recent press releases stylesheet. In our case, we will select /web/stylesheets/recent press releases.
  6. Now click Submit to save the page.

The resulting page shows the new recent press releases area, displaying the appropriate press release links. In our case, the about and agents pages appear. However, no summary shows up below the links, because that field is not filled out on the page metadata. We go into the press releases folder and put in summary metadata for both pages. We then go back to the index page and everything looks great. The recent press releases stylesheet should be customized further to fit in with your site look-and-feel, but this provides a nice starting point.



Thanks for going through Part 3 of the Technical Introduction. Part 4 is available online:

  • Learn how to use external links, set up RSS feeds, and create advanced data definitions

Videos

Last modified on Tue, 12 Jun 2007 15:29:26 -0400

Topic Feedback Form

Content Rating:
Email:
Feedback:


Top / Previous / Up / Table of Contents