Not a developer? Go to MovableType.com

Documentation

Forward Compatibility of Alt Templates and Transformer Callbacks

One important consideration to make when choosing to use either alt templates or transformer callbacks is that they may not be forward compatible with future versions of Movable Type. As Movable Type’s user interface evolves, its HTML and DOM tree made change from release to release to accommodate new features. When this happens it is possible for your callbacks to break, or your alt templates to the user interface a broken look.

This is one of the few instances which requires plugin developers to b vigilant in keeping their plugins up to date with the latest version of Movable Type.

Tip: Use version specific callbacks

To counter this affect and to make sure your plugin works with as many previous versions of Movable Type consider using the following trick that leverages the fact that Movable Type can tell you what specific version of MT is currently running:

sub my_xfrm_callback {
    my ($cb, $app, $tmpl) = @_;
    my $slug = <<END_TMPL;
A whole bunch of HTML here
END_TMPL
    if (MT->version eq "4.0") {
        $$tmpl =~ s/(<li>Tools\n<ul>)/$1$slug/;
    } else {
        $$tmpl =~ s/(<li>Utilities\n<ul class=\"sub\">)/$1$slug/;
    }
}
Back

Leave a Comment