Full Article

How to Display Static Content Within the Symphony CMS

There have been several inquiries in the Symphony Forum about displaying static content within the Symphony content management system. I will attempt to describe three basic approaches to accomplishing this. There are many more variations on these approaches than I cover here, but hopefully this will be enough to get Symphony beginners started. The three basic approaches are:

  1. Use a conventional section, data source and page to define, store and display the static content.
  2. Use a static XML data source to define and store the content and a conventional page to display it.
  3. Use only a page to define, store and display the static content, placing all the content in the page's XSL file as HTML.
First Approach

This is the more conventional approach. It is only "static" in the sense that the same entry is displayed each time the page is loaded. Of course, that entry can be edited at any time using the backend editor. For some this is probably preferable to editing HTML content in an XSL file.

To implement this approach create a section and name it, for example, "Static Content." Add a text input field and name it "Name." Add a textarea field and name it "Content." Now you can create as many Static Content entries as you need. Be sure to give each of them unique names.

Create a data source, drawing from Static Content, for each static page that you need. Have that data source filter on Name to extract the desired content. Create a page, connect it to the data source and then write the XSL to display the content.

The most basic implementation is to use one Static Content entry per static page and display all its content as a single entity all in the same style. But you aren't limited to that. You can separate multiple paragraphs of the content using XSL (some-path/p[i], where i = paragraph number) and then displaying each paragraph where you want and in the style you want. Or you can use multiple Static Content entries and have the data source filter for more than one Name (separate the Names with commas).

Second Approach

With this approach no section is needed and no content is stored in the database. Instead create a new data source with a name of your choice and select Static XML (under Custom XML) as the Source. Enter your static content as XML in the Static XML field.

Then create a new page and select the data source that you just created from the list of Data Sources (and any other data sources that you may want). After saving the new page file, edit it to include the XSL that will display the content the way you want it.

This approach avoids the content manipulation required by the first approach but it makes future editing of the content a bit clumsy. Note that you can use a Static XML data source on more than one page if the need arises, and a page can, of course, draw from more than one Static XML data source.

Third Approach

With this approach neither a section nor a data source is required to generate the static content. All the static content is hard-coded in HTML in the page's XSL file. Just create a page and edit the page file.

But this is the most strict case. Chances are you will want to display some of your standard content, such as header, footer and navigation information. That is, you might want to call your master.xsl utility. You might also want to include some dynamic content. In these cases you will have to include the needed data sources in your page definition.

Comments for this article

lifeofbenschi
06 Jan 11, 8:15am

great article!...

Make a comment:

*Required inputs. Your email address will not be published.