![](https://secure.gravatar.com/avatar/cb6b2a19d7ea20358a4c4f0332afc3ef.jpg?s=120&d=mm&r=g)
I'm about to change the search order for templates -- you know, those pesky .html and .txt files that live in $prefix/templates and $prefix/lists/$mylist. This change is necessary to properly support language templates, and also provides a much requested feature, namely that you will only need to specialize templates that you actually want to change, and that you have multiple levels of specialization. Here's how it works. There are 4 levels of template specialization: list-centric, vhost-centric, site-centric, and default, corresponding to the directories $prefix/lists/$listname $prefix/templates/$host_name $prefix/templates/site $prefix/templates Each of these locations is further organized by language subdirectories. So let's say you were looking for the listinfo.html template for list foobar in language es. You'd actually end up searching 12 directories, with of course, the first hit stopping the search. Let's say further that list foobar is in the www.foobar.com virtual domain, and that it's list-preferred language is fr, while the server's default language is en. Here's the files you'd search for: $prefix/lists/foobar/es/listinfo.html $prefix/templates/www.foobar.com/es/listinfo.html $prefix/templates/site/es/listinfo.html $prefix/templates/es/listinfo.html $prefix/lists/foobar/fr/listinfo.html $prefix/templates/www.foobar.com/fr/listinfo.html $prefix/templates/site/fr/listinfo.html $prefix/templates/fr/listinfo.html $prefix/lists/foobar/en/listinfo.html $prefix/templates/www.foobar.com/en/listinfo.html $prefix/templates/site/en/listinfo.html $prefix/templates/en/listinfo.html Note that the Mailman 2.0.x search directories of $prefix/lists/*.{html,txt} and $prefix/templates/*.{html,txt} are deprecated and no longer searched. The bin/upgrade script will actually md5 checksum all the old files and remove any templates in more-specific locations that exactly match their more-general counterparts. Any template in $prefix/lists or $templates will have to be moved manually. It is highly discouraged that you will ever manually edit a file in $prefix/templates/$lang, and Mailman's install target will have every right to overwrite them on an upgrade. That's what the templates/site subdirectory is for; upgrading will never touch site-centric, domain-centric, or list-centric templates. Of course, that means it's up to site administrators to merge in changes to the default templates. Watch for checkins shortly. Comments? -Barry
![](https://secure.gravatar.com/avatar/14b869908505f7499b6ab7838aa9f0d8.jpg?s=120&d=mm&r=g)
On Fri, May 18, 2001 at 02:28:40PM -0400, Barry A. Warsaw wrote:
...and also provides a much requested feature, namely that you will only need to specialize templates that you actually want to change, and that you have multiple levels of specialization.
Here's how it works.
There are 4 levels of template specialization: list-centric, vhost-centric, site-centric, and default, corresponding to the directories
$prefix/lists/$listname $prefix/templates/$host_name $prefix/templates/site $prefix/templates
This is great, I think, since I've hacked the copy of Mailman I'm using similarly to the patch on sourceforge to enable list-specific templates, (but it was a fragile fix at best without mlist being passed to the template merge function). Anyway, I'm glad to see this is being done right, although I seem to remember seeing a comment by someone recently about the 2.1 alpha Mailman assuming that every directory under $prefix/lists/$listname being a language directory for templates, which caused problems with something, and I remember thinking there might be other reasons I'd want more directories for other purposes under a list directory. So, I'd suggest moving all list templates into a 'templates' subdirectory of the list. Ie, the first search is: $prefix/lists/$listname/templates/ This would keep the list directory uncluttered, and also eliminate code ambiguity about putting other directories under the list dir. Also, one other feature I've been thinking about is to make the web interface for editing templates include a pop-up menu of all templates that affect a list, (searching up the hierarchy for each). Then, when the admin chooses to edit one, it is saved in the $listname/templates directory. Therefore, there is no need to install the current 4 list specific templates in the list templates directory to begin with, and list admins are free to modify any templates affecting their list. Hoping that made sense, -jeb -- Jeb Bateman <mailto:jeb@ocha.net> BuyOrganic.org project - http://buyorganic.org
participants (2)
-
barry@digicool.com
-
Jeb Bateman