Movable Type Documentation > Developer

Using the Scoring Interface

Movable Type comes with a scoring framework built in. What does that mean? It means that a developer can very easily bootstrap any object/class/package they define to expose methods to allow for plugins to score, both positively and negatively that object.

Inheriting from the Scorable Interface

To make an object scorable, a developer need only state that their package inherits from the MT::Scorable interface.

 package My::Object::Model;
 use base qw( MT::Object MT::Scorable );

 __PACKAGE__->install_properties({
     # ...
 });

 1;

Using the MT::Scorable Interface

Then you get the methods in the Scorable interface on your model objects:

 sub score_myobject {
     my ($m_id) = @_;
     my $m = My::Object::Model->load($m_id);

     my $is_awesome = $m->score_avg('percent-rating') > 80 ? 1 : 0;

     if ($is_awesome) {
         # do something wicked
     }
 }

See Also

This page was last updated on 2008-04-15, 10:01.  

Submit a User Contributed Note

User contributed notes are a great way to share the knowledge you have gained in using Movable Type.

If you have a technical question or problem, please visit Movable Type Support.

(If you haven't left a note here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)