Table of Contents
PageKit follows a Model/View/Content/Controller design pattern, which is an adaption of the Model/View/Controller pattern used in many other web frameworks, including Java's Webmacro and Struts.
The Model is the user provided classes, which encapsulate the business logic behind the web site
View is set of PageKit Templates, or XSLT files that generate PageKit Templates
Content is set of XML Files
Controller is PageKit
This approach parallels the division of the job responsibilities of a large web development team. The programmers can focus on the Model, the designers on the View, and the content administrators on the (you guessed it!) Content. PageKit provides the Controller which glues everything together.
This way everybody can focus on what they do best, whether it is programming, design, or content. Since the interfaces are simple and well-defined they can easily work together without interfering with each other.
The Model is provided by Perl classes which implement the business logic that is custom to the site. These class files should be located in the Model/ directory. Each URL is translated into a class and method automatically.
It includes support for Data::FormValidator, making the tedious task of input validation easier. To validate a form, you simply specify required fields and constraints. If there is an error, you can return to the input form, and the invalid fields automatically get highlighted in red.
The View is defined by a set of PageKit Templates making up pages and their components located in the View/ directory. These templates can be in HTML, WML, XML, or any text based format.
Alternatively, you can provide a set of XSLT files that will generate PageKit Templates.
PageKit Template is based on HTML::Template. There are different sets of tags, depending on where the data is being pulled from.
The Model Tags, <MODEL_VAR>, <MODEL_LOOP>, and <MODEL_IF>, are filled with data by the Model.
The Content Tags, <CONTENT_VAR> and <CONTENT_LOOP>, contain XPath queries to the Content XML data.
The PageKit Tags are set internally by the Controller.
It is easy to implement multiple views, such as a printable version of a web page or a co-branded site. To create a new view, simply create a directory containing template files for the view. You only have to create templates for pages and components that you wish to override. That is all views inherit from the default set of templates.
Content is stored in an XML files. It is accessed either through XPath queries from PageKit Template using HTML::Template::XPath or by applying XSLT stylesheets to transform the XML into a PageKit Template.
Language localization couldn't be easier. Simply use the xml:lang attribute in the tags you wish to localize. For example, to have a title available in both English and Spanish use:
<title xml:lang="en">Title in English</title> <title xml:lang="es">Titulo en Español</title>
The Controller is the glue that holds everything together. To deliver a page it calls the appropriate code in the Model, generates the PageKit Template from the Content if necessary, then fills in the tags in the PageKit Template.
It makes the tedious task of authentication/authorization easy, with support for cookie based logins and session inactivity timeouts. After a login or registration, the user is redirected to the protected page they originally requested, if applicable.