- NAME
- SYNOPSIS
- DESCRIPTION
- USAGE
- $entry->next
- $entry->previous
- $entry->author
- $entry->category
- $entry->categories
- $entry->is_in_category($cat)
- $entry->comments
- $entry->comment_count
- $entry->ping_count
- $entry->archive_file([ $archive_type ])
- $entry->archive_url([ $archive_type ])
- $entry->permalink([ $archive_type ])
- $entry->text_filters
- DATA ACCESS METHODS
- DATA LOOKUP
- NOTES
- AUTHOR & COPYRIGHTS
NAME
MT::Entry - Movable Type entry record
SYNOPSIS
use MT::Entry; my $entry = MT::Entry->new; $entry->blog_id($blog->id); $entry->status(MT::Entry::RELEASE()); $entry->author_id($author->id); $entry->title('My title'); $entry->text('Some text'); $entry->save or die $entry->errstr;
DESCRIPTION
An MT::Entry object represents an entry in the Movable Type system. It contains all of the metadata about the entry (author, status, category, etc.), as well as the actual body (and extended body) of the entry.
USAGE
As a subclass of MT::Object, MT::Entry 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::Entry interface:
$entry->next
Loads and returns the next entry, where "next" is defined as the next record in ascending chronological order (the entry posted after the current entry). entry $entry).
Returns an MT::Entry object representing this next entry; if there is not a next entry, returns undef
.
Caches the return value internally so that subsequent calls will not have to re-query the database.
$entry->previous
Loads and returns the previous entry, where "previous" is defined as the previous record in ascending chronological order (the entry posted before the current entry $entry).
Returns an MT::Entry object representing this previous entry; if there is not a next entry, returns undef
.
Caches the return value internally so that subsequent calls will not have to re-query the database.
$entry->author
Returns an MT::Author object representing the author of the entry $entry. If the author record has been removed, returns undef
.
Caches the return value internally so that subsequent calls will not have to re-query the database.
$entry->category
Returns an MT::Category object representing the primary category of the entry $entry. If a primary category has not been assigned, returns undef
.
Caches the return value internally so that subsequent calls will not have to re-query the database.
$entry->categories
Returns a reference to an array of MT::Category objects representing the categories to which the entry $entry has been assigned (both primary and secondary categories). If the entry has not been assigned to any categories, returns a reference to an empty array.
Caches the return value internally so that subsequent calls will not have to re-query the database.
$entry->is_in_category($cat)
Returns true if the entry $entry has been assigned to entry $cat, false otherwise.
$entry->comments
Returns a reference to an array of MT::Comment objects representing the comments made on the entry $entry. If no comments have been made on the entry, returns a reference to an empty array.
Caches the return value internally so that subsequent calls will not have to re-query the database.
$entry->comment_count
Returns the number of comments made on this entry.
Caches the return value internally so that subsequent calls will not have to re-query the database.
$entry->ping_count
Returns the number of TrackBack pings made on this entry.
Caches the return value internally so that subsequent calls will not have to re-query the database.
$entry->archive_file([ $archive_type ])
Returns the name of/path to the archive file for the entry $entry. If $archive_type is not specified, and you are using multiple archive types for your blog, the path is created from the preferred archive type that you have selected. If $archive_type is specified, it should be one of the following values: Individual
, Daily
, Weekly
, Monthly
, and Category
.
$entry->archive_url([ $archive_type ])
Returns the absolute URL to the archive page for the entry $entry. This calls archive_file internally, so if $archive_type is specified, it is merely passed through to that method. In other words, this is the blog Archive URL plus the results of archive_file.
$entry->permalink([ $archive_type ])
Returns the (smart) permalink for the entry $entry. Internally this calls archive_url, which calls archive_file, so $archive_type (if specified) is merely passed through to that method. The result of this method is the same as archive_url plus the URI fragment (#entry_id
), unless the preferred archive type is Individual, in which case the two methods give exactly the same results.
$entry->text_filters
Returns a reference to an array of text filter keynames (the short names that are the first argument to MT::add_text_filter. This list can be passed directly in as the second argument to MT::apply_text_filters.
DATA ACCESS METHODS
The MT::Entry 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 entry.
- blog_id
The numeric ID of the blog in which this entry has been posted.
- author_id
The numeric ID of the author who posted this entry.
- status
The status of the entry, either Publish (
2
) or Draft (1
). - allow_comments
An integer flag specifying whether comments are allowed on this entry. This setting determines whether
<MTEntryIfAllowComments>
containers are displayed for this entry. Possible values are 0 for no comments, 1 for open comments and 2 for closed comments (that is, display the comments on this entry but do not allow new comments to be added). - convert_breaks
A boolean flag specifying whether line and paragraph breaks should be converted when rebuilding this entry.
- title
The title of the entry.
- excerpt
The excerpt of the entry.
- text
The main body text of the entry.
- text_more
The extended body text of the entry.
- created_on
The timestamp denoting when the entry record was created, in the format
YYYYMMDDHHMMSS
. Note that the timestamp has already been adjusted for the selected timezone. - modified_on
The timestamp denoting when the entry record was last modified, in the format
YYYYMMDDHHMMSS
. Note that the timestamp has already been adjusted for the selected timezone.
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
- status
- author_id
- created_on
- modified_on
NOTES
- When you remove an entry using MT::Entry::remove, in addition to removing the entry record, all of the comments and placements (MT::Comment and MT::Placement records, respectively) for this entry will also be removed.
AUTHOR & COPYRIGHTS
Please see the MT manpage for author, copyright, and license information.