Six Apart Code

<<

NAME

MT::TemplateMap - Movable Type archive-template association record

SYNOPSIS

    use MT::TemplateMap;
    my $map = MT::TemplateMap->new;
    $map->blog_id($tmpl->blog_id);
    $map->template_id($tmpl->id);
    $map->archive_type('Monthly');
    $map->file_template('<$MTArchiveDate format="%Y/%m/index.html"$>');
    $map->is_preferred(1);
    $map->save
        or die $map->errstr;

DESCRIPTION

An MT::TemplateMap object represents a single association between an Archive Template and an archive type for a particular blog. For example, if you set up a template called Date-Based and assign to the Monthly archive type in your blog, such an association will be represented by one MT::TemplateMap object.

USAGE

As a subclass of MT::Object, MT::TemplateMap inherits all of the data-management and -storage methods from that class; thus you should look at the MT::Object documentation for details about creating a new object, loading an existing object, saving an object, etc.

DATA ACCESS METHODS

The MT::TemplateMap object holds the following pieces of data. These fields can be accessed and set using the standard data access methods described in the MT::Object documentation.

  • id
  • The numeric ID of the template map record.

  • blog_id
  • The numeric ID of the blog with which this template map record is associated.

  • template_id
  • The numeric ID of the template.

  • archive_type
  • The archive type; should be one of the following values: Individual, Daily, Weekly, Monthly, or Category.

  • file_template
  • The Archive File Template for this particular mapping; this defines the output files for the pages generated from the template for this archive type, using standard MT template tags.

  • is_preferred
  • A boolean flag specifying whether this particular template is preferred over any others defined for this archive type. This is used when generating links to archives of this archive type--the link will always link to the preferred archive type.

DATA LOOKUP

In addition to numeric ID lookup, you can look up or sort records by any combination of the following fields. See the load documentation in MT::Object for more information.

  • blog_id
  • template_id
  • archive_type
  • is_preferred

NOTES

  • When you remove a MT::TemplateMap object using MT::TemplateMap::remove, if the $map object you are removing has the is_preferred flag set to true, and if there are any other MT::TemplateMap objects defined for this particular archive type and blog, the first of the other objects will be set as the preferred object. Its is_preferred flag will be set to true.

AUTHOR & COPYRIGHTS

Please see the MT manpage for author, copyright, and license information.

<<

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.