Plugin: Share Required Templates


Share makes use of two Template Modules, which you’ll need to create. Examples can be found in the plugins/Share/default_templates/ folder, in the distribution.

Share Email Body

The Share Email Body Template Module is used to create the email Share will send. This is where you can specify HTML and CSS when creating an HTML-formatted email. You can use any of Movable Type’s template tags here to craft the body of your message (presumably to match your site’s design). Refer to plugins/Share/default_templates/email.mtml for a working example. Note the use of Share’s template tags — especially ShareSelectedID, as used to enter the entry context.

Create a new Template Module at either the blog or system level named “Share Email Body.” Share will look for this Template Module first at the blog level, then at the system level.

When creating your HTML email template, remember that sending HTML email has its own set of rules to follow, such as using inline styles for formatting and tables for layout. A Google search turns up some helpful sites.

Share Email Result

The Share Email Result template is used to provide the user with feedback about their submission: whether their message was successfully sent, their email address was entered incorrectly, etc. plugins/Share/default_templates/result.mtml shows the single tag used here: ShareResult.

Create a new Template Module at either the blog or system level named “Share Email Result.” Share will look for this Template Module first at the blog level, then at the system level.

Share Email Form

Ok, so the Share Email Form isn’t exactly a required template module… you can set up the form in a template module or directly in your Entry Archive template. Refer to plugins/Share/default_templates/form.mtml for a working form example. By placing the form in a separate template module you can include it in your Entry Archive by simply including it (you probably want to include it right after the comments are included):

<mt:Include module="Share Email Form">

When a user interacts with the Share form they are required to enter a single valid “from” email address and a single valid “to” email address. The message field is optional, though if text is entered it’s restricted by the Message Length setting (if enabled).