SPLCMS Introduction and Screenshots
SPLCMS is one of the example applications from the WebSPL framework,
which is part of
SPL. It is a small CMS (Content
Management System) in less then 500 lines of SPL code. The sources
can be browsed
here.
SPLCMS is a simple Content Management System written in SPL. It is using
XML for storing the actual
content and
XSLT for rendering static HTML
files.
The administrator can define his own objects for representing the content
objects. This object definitions are stored in the
classes.xml
file. Users can then create and modify such
content objects using the editor backend (
splcms.webspl).
The actual HTML files are rendered using the
render.xsl
XSLT file. This XSLT is processed for every output HTML file.
The rendering process is triggered by clicking on the "(Re-)Render HTML
Files" button in the editor backend or by manually executing the
render.spl
script.
The
classes.xml file contains the descriptions of the content
object classes. Each
content object class has a name, a list of allowed child classes, a short
definition for
automatically creating object titles in the editing backend and a list of
parameters. This
parameters are the actual data tuples assoziated with an object.
Each object is represented as an XML node in the
data.xml file.
The class name is
used as XML element name in the file.
Each parameter again has a name, a type and some information for the
editing backend how a parameter
should be displayed in the backend. The type is eigther
attribute
or
element. The
attribute parameters are stored directly in the object XML element
as XML attributes,
the
element parameters are stored as child elements.
Have a look at the example
classes.xml
file. It is pretty much self explainatory.
The XSLT renderer is implemented in the seperate script file
render.spl. This makes it
easier to make local modification to the rendering process.
This script creates a list of all <page> elements in the
data.xml file and is
processing
render.xsl for each <page> element. The output of
the XSLT is then
written to an HTML file named after the name= attribute of the <page>
element. So, if you
would like to use
render.spl unmodified you need to specify a
page class in
your
classes.xml and this class needs to have a
name
parameter of the
attribute type. The HTML files are stored in the
html/
directory.
The page name is passed as XSLT parameter
page to the XSLT.
The files from the
static/ directory (usually images and the
CSS file) is
automatically symlinked to the
html/ directory.
Additional logic (such as fetching external
RSS feeds) can be
easily added to the
render.spl
script.