Live365 Station Page Template System -- Inheritance
The Station Page Template System takes advantage of the concept of
inheritance to increase programming power and maintain system
flexibility. First, we leverage Mason's "content wrapping"
functionality to generate HTML code like the layers of an
onion. Also, we use Mason's object-oriented features which allow us to
define general-use methods and attributes in a "parent" file, and then override them
within "children" files on a case-by-case basis for customization. In addition, Cascading
Style Sheets (CSS) are also used to maintain consistency and
scalability throughout the presentation layer. These features
facilitate the rapid deployment of a co-branded station-page
presentation, and allow us to offer a wide variety of customization for
that presentation.
Content Wrapping
Mason lets us define common web-page elements in a "master template
file" called an autohandler. One autohandler file can exist in
any given directory -- and autohandlers can be nested by placing them
in a tree of subdirectories. Whenever a Mason page-request is made, the
Mason engine walks backwards up the directory tree (from the URL) and
calls any autohandler files found, executing the PERL and HTML code
within each before finally parsing the requested file. A practical example
of this mechanism is that we can place the HTML code for a common page
header and footer into an autohandler located at the root directory of a website,
and that header and footer code will automatcially get added to all
the pages of a website -- without having to do any additional work (no
"include" statements are needed in any of the pages). Page-specific
files are then free to contain only the code relevant to their content, layout,
and/or functionality. Each successive layer of code (root
autohandler, subdirectory autohandler, requested file) "wraps" from
the outside in, giving rise to the "layers of an onion" analogy. We
employ this wrapping mechanism in the Station Page Template System to
insure consistency throughout the various presentations generated by
the system. Common HTML elements (e.g., HTML page title, open & close
BODY tags) and basic functionality are defined in our root autohandler
and then shared by all pages.
Parents and Children
Mason also provides object-oriented-programming features similar to
methods and attributes in parent classes and sub-classes. We can define methods
and attributes in a parent file, use them as desired, and also
redefine/override them as specific cases warrant. The parent is
usually a root autohandler, and the child is a subdirectory
autohandler or a specific page (.live file). We could, for example,
define a "getTitle" method in a root autohandler which prints "Welcome
to Live365" as a page's title in the header contained in that
autohandler. Then, in an autohandler in the /broadcast subdirectory,
we could redefine the getTitle method to instead print "Live365
Broadcast Admin for $station_name", and all of the pages contained in
that directory would automatically get the revised title. In the
Station Page Template System, we define methods such as "getCss",
"getTitle", "drawHeader", and "drawFooter" in our top-level
autohandler which perform their expected tasks by default. However,
since these are methods, we can redefine them on a per-SCP basis to
customize their functionality.
CSS
The cascading style sheet architecture for the Station Page Template
System has been revised to improve reuseablity and maintainability.
The content of the various web pages has been broken down into
specific modules, each with a unique CSS selector. HTML elements
within each module are then further customized to control
styles/colors/positioning. This model produces a style sheet that
serves as the default look & feel for the "generic" case. Fonts,
colors, graphics, and positioning can then be modified by creating a
second, client-specific stylesheet which inherits from the default and only
modifies the minimum number of parameters to achieve the desired level
of customization.