Template Inheritance is a plugin for Movable Type that enables you to link templates together in a way that one template inherits its template code from another template. One example is when you have two or more blogs in your MT system, and you want to use the same design or template layout for each blog. Using the Template Inheritance plugin, you can effectively use one blog's templates as master templates that control the templates of the other blogs. So if you have 3 blogs on a company site with same look and feel, this can save you a lot of time manually updating the templates of each blog every time you make a change. Another way to think of it is sharing templates between several blogs. You can link all the templates in one blog to another, or selectively choose which templates should be inherited (including template modules).
I have wanted a plugin like this for years, the ability to share template code between multiple blogs. For a long time, MT has included a "Link this template to a file" feature in which you could link a template to an actual file on your server. I used to link multiple templates to the same file, effectively (and indirectly) sharing the template code between different blogs. While this works, it has its problems. At times in the past, there we MT bugs that prevented templates from being updated from the file - but I think those are fixed now. The other main problem is that you have to be very careful when editing a template, remembering that it may be shared with other blogs, etc. The Template Inheritance plugin is an improvement over the file linking method, addressing the key issues with file-based linking.
For any specific template, you can assign another template on the system from which to inherit template code. For example you could decide that you want template "B" to inherits its template code from template "A".
It may be helpful to think of "A" as the parent template and "B" as the "child" template -- the child inherits its template code from its parent. When template becomes linked to parent template, the child's template code will immediately be replaced by the template code of the parent, and will be derive its template code from the parent from that point forward. You won't be able to edit the child template after the link is made (the template code is greyed-out and the field is disabled) -- instead, you will see a link to the parent template, and you can then edit the parent template.
Editing the parent template will automatically update all of its children templates. Of course, you need to rebuild the appropriate pages on each blog for template changes to be reflected on your blogs. You remove remove inheritance (break the link with the parent) at any time. When you remove inheritance from a child template, it becomes independent from that point forward, and you can now customize it independently of the parent template.
- Only system administrators (sometimes called superusers) can create inheritance links.
- You must enable the plugin for each blog before you can create inheritance links (blogs to have "child" templates need to be enabled, not those containing the "parent" templates)
- A template cannot be both a child and a parent. If you try to assign inheritance from a template that is a child of another template, it will work -- but the plugin will make the link directly the ultimate parent. This makes it easier to manage, as you won't have to trace template linkages through several generations to find the "master" template.
- When a parent template is deleted, each of its children immediately become independent (orphaned, if you will).
- When first assigning inheritance to a template, the child template's code is replaced by that of the new parent. BE CAREFUL, there is no undo, the child's former template code will be gone. Just to be safe, it may be a good idea to back up the old template code beforehand, in case you decide to revert back.
- MT 3.3+
Great for Blog Networks
While Template Inheritance can be used in many different scenarios, it is a great fit for blog networks. Networks of blogs on the same MT system often have similar (or identical) design or template code. Sometimes only certain things are the same, such as a common header / footer, stylesheet, sidebar, advertising blocks, etc. Using this plugin to link up those common template elements, you can save a lot time managing the templates of the network. If you have a blog network and this sounds interested, please contact me. I can help implement this for you, customize the plugin to meet your specific needs, etc.
- Extract the contents of the zip file and upload the contents of the 'plugins' directory into the 'plugins' directory of your MT installation
- Login to MT (or hit Main Menu, if you are already logged in). You should now see and upgrade screen that will install a table for Template Inheritance.
- Browse to the blog you want, then go to the plugin settings to enable the plugin.
- Browse to the template you want, then click the "Click here to inherit code from another template" link.
- Enter the template ID of the desired parent in the prompt box, hit OK.
- The template is now linked to the parent. Rebuild to see the results on your site.
Get Template Inheritance
Template Inheritance is free for personal use on up to 3 blogs.
Donations are appreciated:
Membership required, please sign-in or register:
Commercial License (4-10 blogs): $97
Blog Network License (10+ blogs): $249
As always, feedback and suggestions are appreciated. Please reply to this entry.