Template Externalizer Gets Love
Template Externalizer, a CMS Made Simple module that allows you to use your favorite text editor rather than the browser based editors for editing templates and stylesheets has been a much loved addon module for the hard core CMS Made Simple website builder.
It has been a long while... .A very long while indeed since the much loved Template Externalizer module has been given any love. This is partly because the original developer (tamlyn) has dropped out of the CMS community.... We don't know why, and we really wish he was still doing his magic. But, I've picked up the slack.
The Template Externalizer module worked great for years. It allows users who have direct access to their webserver files (or some intelligent os integrated system like webdav or an intelligent ftp client) to use their favorite text editors to edit CMS Made Simple's page templates and stylesheets. When you save the file in your editor, and then refresh a page with your browser, the template additions or stylesheet changes are there.
Unfortunately, it didn't work with the module templates.... Like the summary and detail templates of the News module. This was largely because these templates were kept in a different database table, and the API for module templates wasn't quite as advanced when the Template Externalizer module was written, as it is now. However, I am happy to say that this has changed.
I've been doing some recent sponsored development work on a new module I call ManyBaskets . (This is a module that can be used for gift giving, basically allowing you to build many different baskets, fill them all with different items from the Products module, specify different shipping addresses, place a single order, pay once and let the website administrator handle all the shipping). And I was adding quite a bit of javascript into the templates. Using the browser based editor was a bit painful.
Yesterday after talking on the IRC channel with the other regulars there, and reading through the source for the Template Externalizer module, I figured it wouldn't be too difficult to modify this module so that it handled module templates as well
Infact, I was correct. This morning, it took about two hours work to bring the TemplateExternalizer module up to modern specs, and also add support for module templates.
Here's a brief summary of what is in Template Externalizer version 1.2
- The module is split into multiple files now to make it leaner, and less memory intensive for most operations. Code that doesn't need to be loaded for each request is now in seperate files.
- I now require CMS Made Simple 1.4.1 - This is primarily because I update the minimum system requirements of all my modules to the latest recommended version whenever I release them. It usually helps to keep people on recent versions of the core package.
- When 'development mode' is enabled, the module now exports the database templates for each installed module to a module related subdirectory beneith the specified cache directory.
- The system will now recognise saved changes made by a text editor to one of these files the next time a page is requested.
- I now create dummy index.html files inside the cache directory and each subdirectory as an added little security measure.
So there you go, the system works, and is better, faster, smarter than it was before. There are a few caveats though.
There is no mechanism in the module API to generate events whenever a module database template is added, deleted or changed. This means that there is only a one way mechanism between TemplateExternalizer and module templates. Template Externalizer will not react to changes you make in module templates via the browser interface. To see these changes in the Template Externalizer files yo uwill need to toggle 'development mode' off, and then on again via the admin interface. That's it... that's the biggest problem.
TemplateExternalizer 1.2 was released this morning, and now should be available in your ModuleManager panel.
Many Thanks to Tyler Boespflug for Testing
