Zencart Plugin Framework – Day 5 – Introducing the template blocks/holders
|With ZePLUF, I wanted to solve ONE issue that has been bugging me for years working with Zencart: the template editing issue.
Thinking back to the last time you installed a module that adds some new element(s) on your site, think of the process of doing it (in fact, just open that plugin’s README file):
- Edit the file includes/templates/YOUR_TEMPLATE/templates/tpl_product_info.php
- Find this line “blah blah blah”
- Add right about it the code below: “blah blah some code you may don’t event understand”
What is wrong with? Well, many. Think of this:
- 3 months later, you now do not want to use that plugin anymore and want to remove it, can you remember which files you edited to install it?
- You want to temporarily disable this plugin, but oh no you find out this plugin has no on/off switch, you will have to go to the exact template file(s) to remove it
- You want to move this plugin (the newsletter box) for example, to another place, what do you do?
Eventually, installing and removing plugins on your site will leave you with lots of garbage and useless files and such.
ZePLUF introduces the idea of template blocks, or we’d like to call it “holders” . It’s not a brand new idea never been done before, but it’s the first time something like it is introduced into Zencart, and it’s sexy. The “holders” in ZePLUF let you put PLAIN and SIMPLE HTML comments into your template, and the plugins can be hooked into this holders to generate views.
More on that will be covered soon, but for now, enjoy this sexy code: