Xanthia Templating Environment


The Xanthia Templating Environment, or XTE, is a new component added to PostNuke 0.75 that includes the Xanthia and pnRender modules. Where previous versions of PostNuke used static theme files, Xanthia is a complete theme engine with additional functions and greater flexibility. pnRender is a templating engine used to make Xanthia work, but with regard to directly using the module, pnRender itself is mainly useful to module developers.

XTE is based on the Smarty templating engine for PHP (smarty.php.net). It's designed to separate application logic and content from its presentation. This distinction adds a great deal of power to PostNuke 0.75 over previous releases. Now, you can build a theme to alter the design and layout of relatively any feature of your website without the need for third-party add-ons.

How Templates Work

Xanthia works by creating templates, for everything. Each template consists of simple Extensible Hypertext Markup Language (XHTML) you can develop with any text editor. It's like making a mini-web page for just the Poll, for example. Each template is a separate file, and the files are grouped together by reference when you define a theme.

How Zones Work

Each template is associated with a zone. There are two types of zones: Theme Zones and Block Zones. Think of zones as a way to label templates and blocks as abstract objects. Theme Zones allow you to divide up your site into designable pieces, such as "left side" or "header." A Theme Zone can be relatively global, such as a default master zone that pages can use by default, and a Theme Zone can be very specific, such as describing how news articles should look. Figure 10.1 shows a basic layout with zones for the center, sides, header, and overall page.

Figure 10.1. Basic Theme Zone layout.


Tip

If you are having trouble visualizing the zones, try drawing them out on a sheet of paper. Think of it like a map. Start with a given page, and divide it up into separate areas, such as header, footer, navigation, and so on. After you have all the areas mapped out, you will know how many zones you need, and what to name them.


Block Zones define the placement of module block areas. Block Zones are not specifically required when working with your Xanthia themes, but they are suggested and can provide additional, more specific positioning options. Figure 10.2 shows some areas on a given example page that could be managed as Block Zones. Block Zones should be placed inside Theme Zones.

Figure 10.2. Block Zones can define areas for blocks.


Multiple blocks can be displayed within one Block Zone. Block Zones don't have template files to define how they look; they help you manage where blocks should be placed.

In essence, the XTE system is separating the design of page areas from the display of content through blocks. A given look is made into an object with a Theme Zone name, and one or more modules are also abstracted as a Block Zone. You style the appearance of content by placing Block Zones inside Theme Zones.

How Themes Work

A Xanthia theme collects all the zones and templates together, allows you to define styles, and packages it together under a theme name. When you apply a new theme, you are activating all those zones, using all those templates, and restyling your site.

Template files cannot be used without being added to a theme first. Zones are similarly defined as part of a theme and then assigned a template. Each theme has color variables you can create and a series of settings that generally describe how the theme will work.

Special XTE logic variables can be written into the templates using a format similar to a Hypertext Markup Language (HTML) comment:

 <!--[$NAMEOFOBJECT]--> 

These variables allow you to queue the display of an element at that point in your XHTML code. For example, after you define the theme's left column width, it is referenced in a theme like this:

 <td style="width:<!--[$lcolwidth]-->; vertical-align:top;"> 

Block Zones are designated in the same way. So, if you define a Block Zone called "MENU" and plan on displaying it in the left column, you can do so like this:

 <td style="width:<!--[$lcolwidth]-->; vertical-align:top;"> <!--[$MENU]-->; </td> 

All Xanthia theme elements are referenced through these variables.



    PostNuke Content Management
    PostNuke Content Management
    ISBN: 0672326868
    EAN: 2147483647
    Year: 2003
    Pages: 207
    Authors: Kevin Hatch

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net