Skip to content

designguide theme modules

Violet edited this page Dec 6, 2010 · 1 revision

MTDG: Modules, Widgets and Widget Sets

Template modules and widgets are virtually indistinguishable from one another. In fact the most common observation and question made by designers is, "I honestly can't tell the difference between the two. Why differentiate?"

The answer lies in a desire to keep the widget management function of Melody free and clear of widgets/modules that are not designed to be widgets, or stand alone page elements. For example, consider how confusing it might be to a user if Melody's drag-and-drop widget management interface gave users the option to place the following template modules into the sidebar of a blog:

  • Entry Summary
  • Blog Header
  • HTML Head

Hence, we disambiguate between widgets and modules even though technically they are virtually identical to one another.

Template Modules

Template modules serve as template fragments that can be shared between templates. They are an excellent way for example of sharing the exact same code to produce the header of your website across all of your templates. This means that in the event that you need to update your logo then all you have to do is edit a single module and you are done.

Template modules can be configured in ways other templates can not, and can be fine tuned to provide great performance enhancements to your website, by utilizing features like:

  • Template Module Caching
  • Server Side Includes

Both of these topics are sufficiently complex that they are covered in much greater detail in the document entitled "Template Module Caching."

Example

  module:
    sitemap_mod:
      label: 'Sitemap Include'
      include_with_ssi: 1
      cache:
        expire_type: 1
        expire_interval: 60

Widgets

Widgets are a type of template module indented for use within the sidebar of a website. Widgets are made available to users of Melody within its widget management interface in which users can drag and drop widgets to and from sidebars on the website. They share many, if not all, of the characteristics of a template module.

Example

  widget:
    w_learn_more:
      label: 'Learn More'
    w_photo_of_the_day:
      label: 'Photo of the Day'

Module and Widget Caching Options

Module and Widget caching is one of Melody's most powerful features in that when properly utilized it can have the most profound impact upon publishing performance.

Learn more: Template Module Caching

Tip: Keep in mind that setting any of these options presumes that module caching has been enabled on the blog in question. Rest assured however that even if module caching is disabled for the current blog at the time the theme was applied, the preferences you declare within your themes configuration file will be respected once module caching is enabled.

Expiration Types and Intervals

  • 1 - Expire the cache after a period of time.
  • 2 - Expire the cache upon a specific event.

Expiration Event Types

Users can select from among the following to determine when a module's cache will be flushed. Each of the options below refers to an object type (Author, Entry, TrackBack, etc) that when created, updated or deleted will trigger the cache to be flushed.

  • asset
  • author
  • category
  • comment
  • entry
  • folder
  • page
  • tbping

Widget Sets

Widget sets are nothing more than containers for a group of widgets. For many websites, the term "widget set" might be interchangeable with the concept of "sidebars" in that widgets are often arranged in some way in the sidebar of each and every page of a website.

Widget sets have two primary properties: a name and a listing of widgets contained by them. Widget sets can be inserted into a website using the template tag:

<$mt:WidgetSet name="Homepage Sidebar"$>

Example

  widgetset:
    homepage:
      label: "Homepage Sidebar"
      widgets:
         - 'Search Box'
         - 'Advertisement'
         - 'Recent Comments'
         - 'Popular Entries'

This example presumes that the theme also possess four widgets: Search Box, Advertisement, Recent Comments and Popular Entries.

Continue Reading

 

Category: Guide

Tags: theme design


Questions, comments, can't find something? Let us know at our community outpost on Get Satisfaction.

Credits

  • Author: Byrne Reese
  • Edited by: Violet Bliss Dietz
Clone this wiki locally