<<

NAME

MT::Blog - Movable Type blog record

SYNOPSIS

    use MT::Blog;
    my $blog = MT::Blog->load($blog_id);
    $blog->name('Some new name');
    $blog->save
        or die $blog->errstr;

DESCRIPTION

An MT::Blog object represents a blog in the Movable Type system. It contains all of the settings, preferences, and configuration for a particular blog. It does not contain any per-author permissions settings--for those, look at the MT::Permission object.

USAGE

As a subclass of MT::Object, MT::Blog 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.

The following methods are unique to the MT::Blog interface:

$blog->file_mgr

Returns the MT::FileMgr object specific to this particular blog.

DATA ACCESS METHODS

The MT::Blog 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 blog.

  • name

    The name of the blog.

  • description

    The blog description.

  • site_path

    The path to the directory containing the blog's output index templates.

  • site_url

    The URL corresponding to the site_path.

  • archive_path

    The path to the directory where the blog's archives are stored.

  • archive_url

    The URL corresponding to the archive_path.

  • server_offset

    A slight misnomer, this is actually the timezone that the user has selected; the value is the offset from GMT.

  • archive_type

    A comma-separated list of archive types used in this particular blog, where an archive type is one of the following: Individual, Daily, Weekly, Monthly, or Category. For example, a blog's archive_type would be Individual,Monthly if the blog were using Individual and Monthly archives.

  • archive_type_preferred

    The "preferred" archive type, which is used when constructing a link to the archive page for a particular archive--if multiple archive types are selected, for example, the link can only point to one of those archives. The preferred archive type (which should be one of the archive types set in archive_type, above) specifies to which archive this link should point (among other things).

  • days_on_index

    The number of days to be displayed on the index.

  • file_extension

    The file extension to be used for archive pages.

  • email_new_comments

    A boolean flag specifying whether authors should be notified of new comments posted on entries they have written.

  • allow_comment_html

    A boolean flag specifying whether HTML should be allowed in comments. If it is not allowed, it is automatically stripped before building the page (note that the content stored in the database is not stripped).

  • autolink_urls

    A boolean flag specifying whether URLs in comments should be turned into links. Note that this setting is only taken into account if allow_comment_html is turned off.

  • sort_order_posts

    The default sort order for entries. Valid values are either ascend or descend.

  • sort_order_comments

    The default sort order for comments. Valid values are either ascend or descend.

  • allow_comments_default

    The default value for the allow_comments field in the MT::Entry object.

  • convert_paras

    A comma-separated list of text filters to apply to each entry when it is built.

  • convert_paras_comments

    A comma-separated list of text filters to apply to each comment when it is built.

  • status_default

    The default value for the status field in the MT::Entry object.

  • allow_anon_comments

    A boolean flag specifying whether anonymous comments (those posted without a name or an email address) are allowed.

  • allow_unreg_comments

    A boolean flag specifying whether unregistered comments (those posted without a validated email/password pair) are allowed.

  • words_in_excerpt

    The number of words in an auto-generated excerpt.

  • ping_weblogs

    A boolean flag specifying whether the system should send an XML-RPC ping to weblogs.com after an entry is saved.

  • mt_update_key

    The Movable Type Recently Updated Key to be sent to movabletype.org after an entry is saved.

  • language

    The language for date and time display for this particular blog.

  • welcome_msg

    The welcome message to be displayed on the main Editing Menu for this blog. Should contain all desired HTML formatting.

METHODS

  • clone( [ \%parameters ] )

    MT::Blog provides a clone method that supports cloning of all known child records related to the MT::Blog object. To invoke this behavior, you simply specify a parameter hash with a 'Children' key set.

        # Clones blog and all data related to this blog within the database.
        my $new_blog = $original_blog->clone({ Children => 1 });

    You may further specify what kind of records are cloned in the process of cloning child objects. Use the 'Classes' parameter to specifically exclude particular classes:

        # Clones everything except comments and trackback pings
        my $new_blog = $original_blog->clone({
            Children => 1,
            Classes => { 'MT::Comments' => 0, 'MT::TBPing' => 0 }
        });

    Note: Certain exclusions will prevent the clone process from including other classes. For instance, if you exclude MT::Trackback, all MT::TBPing objects are automatically excluded.

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.

  • name

NOTES

  • When you remove a blog using MT::Blog::remove, in addition to removing the blog record, all of the entries, notifications, permissions, comments, templates, and categories in that blog will also be removed.
  • Because the system needs to load MT::Blog objects from disk relatively often during the duration of one request, MT::Blog objects are cached by the MT::Blog::load object so that each blog only need be loaded once. The MT::Blog objects are cached in the MT::Request singleton object; note that this caching only occurs if the blogs are loaded by numeric ID.

AUTHOR & COPYRIGHTS

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

<<