If you desided to use Movable Type as a website publish platform for some group, community, or company, etc., you would like to apply the same templates to make all your site pages look and feel alike. Sure you can use the "link this template to a file
" function in template editing screen. But then all templates in different weblog will be linked. Except this, you still have to setting this link manually. If yor are using "Template Module
" to form your templates, this uncomfortable dream will become nightmare.
In such a situration, you must want to transfer your hard-working-templates into Movable Type's default template. With this default template, Movable Type will prepare all templates for you when you creating any new weblog. Then you only have to modify them to present the real situration. This is not only a dream. All you have to do, is editing this file with any plain-text editor:
where_your_MT_was_installed/lib/MT/default-templates.pl
This is not really hard. Even my kind of programming idiot can do. But never forget to backup before any modify. There is no guarantee.
This file is quite simple in fact. It says:
[
{
'text' => 'content of Main Index template',
'outfile' => 'index.html',
'rebuild_me' => '1',
'type' => 'index',
'name' => 'Main Index'
},
{
'text' => 'content of RSD template',
'outfile' => 'rsd.xml',
'rebuild_me' => '1',
'type' => 'index',
'name' => 'RSD'
},
{
'text' => 'content of RSS 2.0 template',
'outfile' => 'index.xml',
'rebuild_me' => '1',
'type' => 'index',
'name' => 'RSS 2.0'
},
{
'text' => 'content of Main Archive Index template',
'outfile' => 'archives.html',
'rebuild_me' => '1',
'type' => 'index',
'name' => 'Main Archive Index'
},
{
'text' => 'content of Comment Preview template',
'type' => 'comment_preview',
'name' => 'Comment Preview Template'
},
{
'text' => 'content of Comment Error template',
'type' => 'comment_error',
'name' => 'Comment Error Template'
},
{
'text' => 'content of Popup Uploaded Image template',
'type' => 'popup_image',
'name' => 'Popup Uploaded Image Template'
},
{
'text' => 'content of Comments Listing template',
'type' => 'comments',
'name' => 'Comments Listing Template'
},
{
'text' => 'content of RSS 1.0 template',
'outfile' => 'index.rdf',
'rebuild_me' => '1',
'type' => 'index',
'name' => 'RSS 1.0'
},
{
'text' => 'content of Styles Sheet template',
'outfile' => 'styles-site.css',
'rebuild_me' => '1',
'type' => 'index',
'name' => 'Styles Sheet'
},
{
'text' => 'content of Date Based Archive template',
'type' => 'archive',
'name' => 'Date Based Archive'
},
{
'text' => 'content of Category Archive template',
'type' => 'category',
'name' => 'Category Archive'
},
{
'text' => 'content of Individual Entry Archive template',
'type' => 'individual',
'name' => 'Individual Entry Archive'
},
{
'text' => 'content of TrackBack Pings Listing template',
'rebuild_me' => '0',
'type' => 'pings',
'name' => 'TrackBack Pings Listing Template'
},
{
'text' => 'paz',
'type' => 'custom',
'name' => 'module'
},
]
You will find that this is just a array reference
of hash reference
if you can understand Perl. Don't think about geek's Perl. Let's watch this file just with your instinct (the Force?):
[
", and ends with a "]
". All templates are listed between them;{
", ends with a "}
", and diverged by a ",
";'A' => 'B'
" format, means we want to fill "B" in column "A".Now things go better. You can find this out if you keep working harder:
Label | Meanings | Note |
---|---|---|
text | Template Body | You can paste whole template, including line-break |
outfile | Output file | Please enter the whole filename |
rebuild_me | Rebuild this template when rebuilding Index templates | 1 means yes, while 0 means no |
type | Type of template | Please see below |
name | Template Name | Please enter the name of this template |
We don't finish yet. You have to figure out what "type of template" is available. More then this, each type of template required different set of other columns. Maybe you have to use the Source or use the Force. Never worry about this. I've already digested for you:
Type | Name | Columns can be used |
---|---|---|
Index templates | index | outfile, rebuild_me, name |
Date Based Archive templates | archive | N/A |
Category Archive templates | category | N/A |
Indinidual Entry Archive templates | individual | N/A |
Comments Listing Template | comments | N/A |
Comment Preview Template | comment_preview | N/A |
Comment Error Template | comment_error | N/A |
TrackBack Pings Listing Template | pings | N/A |
Popup Uploaded Image Template | popup_image | N/A |
Template Modules | custom | N/A |
Hey, don't be such hurry. Please note that if there is any "'
" in your "Template Body," you have to add a extra "\
" in front of it turning it into "\'
". Otherwise you will get a "Can't find default template listing; where is default-templates.pl?
" error message.
Well, that's all. You can now play in your own, or wait me packing my own templates into a single default-templates.pl in days.
Posted by Jedi at November 18, 2003 10:19 PM | 中文版 (Chinese Version) | TrackBack (0)Instead od of using:
'text' => 'Testing',
can you use:
'linked_file' => '../index.tmpl',
in the default-templates.pl file to create all the weblogs identically?
You can change on any weblog edit template page and it will update the template file.
My concern is synchronization or lockup.
Thanks for any help
Ted
Posted by Theodore Balaban at April 28, 2004 03:42 AMWell, I think that might work. But I don't sure if this will overwrite the template content in your default-templates.pl file.
Maybe you just can spend some times to test.
Good luck.
Posted by Jedi at October 12, 2004 08:28 AM