Home → 2003/08/27, 11h55

MTRelatedEntry

I am quickly adding this draft version of the MTRelatedEntry plugin documentation. I am using this plugin to produce this multilingual site. More details will be added later.

  • Description: MTRelatedEntry is a container tag that sets the context to another entry that matches the entry being published.
  • Version: 0.9.2

Entries are matched using a master/slave relationship. Every MTRelatedEntry tag manages a one to one relationship between a master and a slave. A master can have multiple slaves if there is more than one tag defined with different blog ids (but there can only be one slave for a master in a given blog.) On the other hand, a slave can have only one master. In other words, the relationship between entries managed by the MTRelatedEntry tag produces one level directed graphs. Each relationship is expressed as 2 MT::PluginData rows that are built like this:


  masterEntryId, slaveBlogId -> slaveEntryId
  slaveEntryId               -> masterEntryId

The MTRelatedEntry tag manages the creation of a slave. When an entry is published with a template that contains the MTRelatedEntry tag, a slave entry is created when these conditions are all true:

  • The tag attribute create is present with a non-zero value
  • The current entry is not the slave of another entry
  • The current entry does not have a slave in the specified blog

Republising master entries

When a master is re-published, the MTRelatedEntry tag will synchronize its slave entry only if the update attribute is true (non-zero). Republishing a slave has no effect on its master entry. Update: this code is disabled.

Removing entries

When a master entry is removed, its slaves are not removed. Same thing for removing a slave entry: its master is not removed. Implementation note: the MT::PluginData rows used to match the removed entry to its slaves are also left intact after an entry removal. We may add support to cleanup obsolete rows in the database, should this become a problem on sites with frequent entry removal.

MTRelatedEntry tag content

The content of the MTRelatedEntry tag is processed in the context of the matched entry (slave or master), if a matched entry exists and if its status is publish (2). If the content is not processed, the empty string is returned.

Attributes

This table lists all the attributes that available to control the behaviour of the MTRelatedEntry container tag. All the attributes are optional.

Attributes
Attribute Values Description Default
blog_id "id" ID of the blog where the matching entry is located (or created) The current blog id
create "non-zero" Indicates that a slave entry should be created if these two conditions are met:
  • The current entry is not the slave of another entry
  • the current entry does not have a slave in the specified blog
0
update "non-zero" Updates the slave entry (if it exists) when the current entry is re-published. 0
copy "non-zero" Copies the master entry's content in the slave entry. The following fields are copied: title, text, excerpt, text_more, allow_commenets, allow_pings, convert_breaks, created_on, status keywords 0
title "title" The title of the slave entry. Overrides the title from the copy attribute. Generated title: MTRelatedEntry->[master entry title]
text "text" The main body text of the slave entry. Overrides the text from the copy attribute. Generated body: MTRelatedEntry created by entry '[master entry title]' (id=[master entry id]) from weblog '[master blog name]' (id=[master blog id])
text_more "text" The extended body text of the slave entry. Overrides the extended body text from the copy attribute.
excerpt "text" The excerpt of the slave entry. Overrides the excerpt from the copy attribute.
status "1|2" The status of the slave entry (draft=1, publish=2) 1
keywords "text" The keywords of the slave entry. Overrides the keywords from the copy attribute.
allow_comments non-zero Enables comments on the slave entry
convert_breaks non-zero Enables comments on the slave entry
allow_pings non-zero Enables pings on the slave entry
created_on a date in this format: YYYYMMDDHHMMSS The creation date of the slave entry

MTExpressions

All attributes can contain MTExpressions. If your MovableType installation contains this plugin, you will be able to dynamically set values on these attributes. The evaluation of the attributes is done in the context of the container entry. See the usage section for an example of MTExpressions.

Usage example

This plugin helps building multilingual sites where each language is offered as an individual weblog. In this context, each time an entry is created in one language, a matching item is added to the other language(s) weblog(s). Using this plugin helps having weblogs that have entries that cross-reference each other: Readers that select a language are informed of entries available in other languages as well. The following example could be used in the english template:


  ...
  This entry is also available in 
    <MTRelatedEntry blog_id="2" 
                 create="1" 
                 status="2"
                 title="Nouvelle entrée non traduite: [MTEntryTitle]"
                 text="">
      <a href="<$MTEntryPermalink$>">French</a> (<$MTEntryTitle$>)
    </MTRelatedEntry>
    and 
    <MTRelatedEntry blog_id="3" 
                 create="1"
                 status="2"
                 title="Nueva entrada no traducida: [MTEntryTitle]"
                 text="">
      <a href="<$MTEntryPermalink$>" title="<$MTEntryTitle$>">Spanish</a> (<$MTEntryTitle$>)
    </MTRelatedEntry>
  ...

When this tag is executed for the first time in an entry, it will create 2 entries: one in the blog #2, and one in blog #3. These entries are added with the status publish. If the templates of the other languages use the same pattern, links to entries in the other languages will also be presented.

Upcoming releases

  • Category mapping
  • Matching existing entries

Comments (1)

  • free psp movie downloads: download psp movies

    Pisté le 2006/01/25 à 22h49, par sony psp movies