The decision was reached through the following 6 criteria.
Performance
The chosen system performed considerably better than both the existing theming engine and the Encompass engine. Testing indicated a performance increase of 15% compared to the existing engine and 95% compared to the Encompass templating engine. Further gains due to optimization are likely. Benchmark results are appended at the bottom. Please note that while great care was taken to benchmark all contenders in the best possible way, there is always room for discussion with benchmark results. The results support the verdict with a satisfactory margin of error however.
XML syntax
Having a good XML story is crucial going forward, with XSLT and related technologies replacing HTML longer-term. The chosen engine uses XML Namespaces to prepare PostNuke for a point in time where it will be feasible to turn over some of the rendering duties to the client. Furthermore, XML increases readability and provides less of a learning curve than Smarty's syntax. XML syntax also allows easy development of templates within WYSIWYG HTML editors.
Small codebase
An important consideration in the decision was overall code size. Smaller code has a large maintenance advantage, and thus weighted heavily in the decision. The Blocklayout engine weighs in at 15KB, the Encompass engine weighs 227KB - 400KB, depending on what is counted.
Hierarchial templating
Templating should be hierarchial for maximum expressive power. This allows to compose page layouts from small building blocks. The chosen engine embodies this concept.
Directory structure
Encompass stores all templates in one folder, regardless of type. Blocklayout separates templates by classification.
1) pages/ - Full page skeletons
2) blocks/ - Block templates
3) modules/(modname)/(functype)/(funcname)/ - Module output templates;
there can be multiple, interchangeable templates for the same module
function even within the same theme. If one is not present the module
uses its own internal default.
Integration with Roadmap
PostNuke has been evolving very rapidly over the course of the last year. The future will bring more changes still. It is imperative that the templating system be able to cope with changes. One way to do that is to have a clear plan where the future direction is concerned. Another is to have a team that is in constant communication with the
PostNuke team.
Information on Blocklayout
Templates
There are 3 kinds of templates in Blocklayout, Master, Slave, Internal. Masters define the overall layout of the page. Slaves "dress" each piece of centent in the theme. Internals lay out the actual content.
Template Locations
Modules and Blocks are distributed with an Internal template for each function that deals with output. These templates are used if there is no correspoding template in the theme. Themes are not required to contain Internal templates.
In fact, I suggest that themes don't. Internal templates in themes is intended as a way for each individual site owner to customize their site even more; the ability of theme designers to include Internals in their theme is a bonus. Obviously, it would be impossible for a theme to include templates for every module.
Themes are only required to contain Master and Slave templates. The Master templates remove the limitation of the 5 zone layout PostNuke currently has. Slave templates replace and extend certain functions within theme.php, such as
themesideblock() and OpenTable() / CloseTable().
Having a standard set of CSS classes will ensure that any properly designed module will integrate with any theme, without the need for any theme to contain Internal templates. This also gives PostNuke the ability to be laid out completely with CSS. Other classes can be added by the theme designer. This also reduces reliance on theme variables such as colors.
Blocklayout Specification
http://www.thedragonsforge.com/postnuke/blocklayout_40.html
Benchmark Results
Encompass:
ab -n1000 -c2 site1
This is ApacheBench, Version 1.3c <$Revision: 1.44 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright (c) 1998-2000 The Apache Group, http://www.apache.org/
Server Software: Apache/1.3.19
Server Hostname: 8.hostnuke.com
Server Port: 80
Document Path: /pn713/index.php
Document Length: 35277 bytes
Concurrency Level: 2
Time taken for tests: 437.928 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 35778000 bytes
HTML transferred: 35277000 bytes
Requests per second: 2.28
Transfer rate: 81.70 kb/s received
Connnection Times (ms)
min avg max
Connect: 0 0 39
Processing: 659 875 1091
Total: 659 875 1130
Blocklayout:
[root@ns5 /root]# ab -n1000 -c2 site2
This is ApacheBench, Version 1.3c <$Revision: 1.44 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright (c) 1998-2000 The Apache Group, http://www.apache.org/
Server Software: Apache/1.3.19
Server Hostname: 8.hostnuke.com
Server Port: 80
Document Path: /html/index.php
Document Length: 9315 bytes
Concurrency Level: 2
Time taken for tests: 223.446 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 9832256 bytes
HTML transferred: 9321746 bytes
Requests per second: 4.48
Transfer rate: 44.00 kb/s received
Connnection Times (ms)
min avg max
Connect: 0 0 2
Processing: 271 446 656
Total: 271 446 658
Traditional PostNuke:
[root@ns5 /root]# ab -n1000 -c2 site3
This is ApacheBench, Version 1.3c <$Revision: 1.44 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright (c) 1998-2000 The Apache Group, http://www.apache.org/
Server Software: Apache/1.3.19
Server Hostname: developer.hostnuke.com
Server Port: 80
Document Path: /index.php
Document Length: 12971 bytes
Concurrency Level: 2
Time taken for tests: 260.773 seconds
Complete requests: 1000
Failed requests: 259
(Connect: 0, Length: 259, Exceptions: 0)
Total transferred: 13475259 bytes
HTML transferred: 12971259 bytes
Requests per second: 3.83
Transfer rate: 51.67 kb/s received
Connnection Times (ms)
min avg max
Connect: 0 0 4
Processing: 359 521 758
Total: 359 521 762