Page 1 of 1

TODCM template engine

PostPosted: June 24th, 2011, 5:30 am
by David Tong
For techies wondering what a TODCM template is, please read on.

TODCM has a very complex template engine and a template format that is specific to TODCM. Yes, we made our own template language and it is based on PHP array structure. I was thinking about using XML structure but it will take too long and harder to code, and I don't need the templates to work across different programming languages so I decided on using PHP array structure. The template engine can be easily extended by using dynamic loading plug-ins. It will take us a long time to document the whole template engine and template language syntax. We are in the process of documenting the template language syntax.

The best part of this template engine is that you can add one or more events to anything in the template. A event handler can tell the template engine to show or not show the template data and pretty much everything else you can do with PHP. Even a simple title can have a event handler. The event handlers are dynamic loading plug-ins and you can easily write your own event handler plug-ins once you understand the event handler base classes. The whole template engine design and implementation is very efficient and running many event handlers won't slow down the page generation much.

If you are interested, here are the locations where you can find the template relevant files:

templates/builder - Stores all the templates for unit pages (unit), professional development (goal) and surveys (survey). Currently, only the unit folder contains one template. We will be adding more unit templates, one new goal template and new survey templates. The system folder contains system related templates such as the site resource and course level (on the course description page) resources.

system/application/libraries/unit - The core of the template engine. Unitmain.php is the template driver program, the rest of the files are modules. The event, paging, pph and uph folders are where the various plug-in code reside. Folder uph is where you can add dynamic plug-in modules to Unitmain.php.

The whole application is based on CodeIgniter Model View Controller (MVC) framework and Object Oriented Programming (OOP) design. Having experience with any MVC framework (can be any language like Java Structs) and OOP concepts would make it much easier to understand the TODCM PHP code.

You can look at TODCM as a content management system (CMS) specialized for curriculum mapping. Where a CMS system allows you to create any kind of websites, TODCM creates curriculum mapping websites. Why didn't I use an existing CMS system to implement TODCM at the first place? Well, there are many curriculum mapping specific features that a typical CMS can not support so the decision was to create a whole new CMS like system to make the implementation easier. I tried not to think too much about using TODCM for purposes other than curriculum mapping but the template design does really support making a website other than curriculum mapping. I think the usage of TODCM will not be limited to curriculum mapping and myself or someone will eventually use the same design and come up with a non-curriculum-mapping related application.