MoreData Plugin for Movable Type
MoreData parses finds and parses CSV strings from any Movable Type tag into a hash or array which can be captured as an MT variable. All with the single tag modifier, moredata.
Get ithe MoreData plugin from my GitHub account.
EMBEDDING THE DATA IN A TEXT FIELD
First embed a string anywhere within a text field accessible from an MT function tag. Let’s use the EntryExcerpt field:
Excerpt
Here is my excerpt which I can output without the data.
---first_name=
Moe,Larry,Curly
---last_name=
Moe=>Howard,
Curly=>Howard,
Larry=>Fine
---say_yes=
Why, certainly!
...
And here is a continuation of the excerpt.
In your template, you can set an MT string, array or hash variable corresponding to one of the named strings (e.g. say_yes string, first_name array, last_name hash).
The moredata modifier accepts one or two arguments: The data identifier is the first argument, and an optional second, the format: (array, hash, or string).
If no format is given, the blog default is used. You capture the data using the setvar = whatever argument.
You should review the Movable Type or Melody documentation of the mt:Var tag with arrays and hashes.
SETTING THE VARIABLES IN YOUR TEMPLATES
<mt:EntryExcerpt convert_breaks="0" moredata="first_name","array" setvar="first_name_a">
<mt:EntryExcerpt convert_breaks="0" moredata="last_name","hash" setvar="last_name_h">
<mt:EntryExcerpt convert_breaks="0" moredata="say_yes","string" setvar="say_yes_s">
IMPORTANT: The convert_breaks="0" filter is important and should usually precede the moredata tag. This filter ensures that no extra formatting is inserted into your data by MT. If the text filter is set to none then you may not need to state explicitly.
USING THE VARIABLES
Array via loop:
<mt:Loop name="first_name_a">
<mt:Var name="__value__">, # gives Moe, Larry, Curly
</mt:Loop>
Array by index:
<mt:Var name="first_name_a[2]"> # gives Larry
Hash by loop:
<mt:Loop name="last_name_h">
<mt:Var name="__key__"> <mt:Var name="__value__">, # gives Moe Howard, Curly Howard, Lary Fine
</mt:Loop> # hash loops have their own special order
Hash by key:
<mt:Var name="last_name_h{Moe}"> # gives Howard
The array index or hash key can be a variable. Here is a slightly sophisticated example, in which I loop through an array, using the array value as the key to a different hash variable.
<mt:Loop name="first_name_a">
<mt:Var name="first_name_a"> says, "I'm Dr. <mt:Var name="last_name_h{$first_name_a}">!<br />
</mt:Loop>
<br />
Can we help you? <mt:Var name="say_yes_s"><br />
RETRIEVING THE TAG CONTENT WITHOUT THE DATA
The content can be output separately with the __content__ key:
My content is: <mt:EntryExcerpt moredata="__content__">
Will output:
“Here is my excerpt which I can output without the data. And here is a continuation of the excerpt.”
For debugging or whatnot, the __data__ key outputs the complete raw data string:
My data is: <mt:EntryExcerpt convert_breaks="0" moredata="__data__">
This produces the full data string, including opentags, but without the close tag.
BLOG-WIDE PLUGIN CONFIGURATION
The plugin takes five blog-wide settings:
opentagshould be a unique string which opens a data section, and is required for each data identifier.closetagis required at the end of the whole dataset. Optionally it can close each data section.datasepis a string that joins items in an array, and key-value pairs.hashsepis a string that joins keys from values.formatis the default format, used when a second argument to themoredatamodifier is not given.
FORMATTING THE DATA
Each data section begins with an identifier, followed immediately by the data identifier and an equals sign:
---my_data=
Each named dataset must be terminated by another named dataset, or a closetag if it is the last, or by the end of the file:
---first=
one,two,three
---second=
snow=>white,ruby=>red
...
You can omit the close tag if the data is at the end of the content.
The named data sets must be in one contiguous block, and only one block is allowed.
(Everything between the first opentag and the closetag (or eof) is considered data).
You can put that data block in the middle of the content (but then don’t forget the close tag).
White space is mostly very flexible. You can pack all the data onto one line, or insert as much whitespace and line returns as you want. Also there are no restrictions about putting data at the start of a line. The only whitespace restriction is that there should be no extra whitespace between the open tag, you data identifier, and the = sign. So for example with the default open tag, you should always do this ---my tag=. In other words your data identifier can only have internal spaces.
CHOOSING TAGS AND SEPARATORS
You can configure the open and close tags and the data and hash separator strings. The data separator and hash separator strings can be the same if you wish. You need to be wary of potential conflicts between your open and close tags, the separators, and your content or data.
- Avoid having your open tags appearing in the preceding content or your close tags appearing in subsequent content.
- You don’t want your data separators (
,,=>etc) to appear in your data, obviously. - You data identifiers can have spaces like
---first name=or be empty---=
In the former you would use moredata="first name". The latter would be moredata="". But don’t use the bareword moredata without at least one argument, even if it is the empty string.
RELATED PLUGINS
The venerable and awesome Key Values plugin by Brad Choate was my inspiration for the MoreData plugin.
SUPPORT
Please send questions, comments, or criticisms to rick@hiranyaloka.com. The
COPYRIGHT AND LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
This software is offered “as is” with no warranty.
MoreData is Copyright 2011, Rick Bychowski, rick@hiranyaloka.com. All rights reserved.
NameParse Plugin for MT4 and Melody
Tag and text filter for parsing a person’s name. A thin wrapper around the Lingua::EN::NameParse cpan module by Kim Ryan.
NameParseComponents Block Tag
mt:NameParseComponents parses the contained block, then joins the components with a separator.
No case conversion. The default separator is whitespace.
For example, to extract and output a first and last name from a mt:AssetLabel tag:
<mt:NameParseComponents given_name_1="1" surname_1="1"><$mt:AssetLabel$></mt:NameParseComponents>
outputs “Frederick Flintstone”
To put last name first, followed by first name:
<mt:NameParseComponents surname_1="1" given_name_1="1" separator=", ">
<$mt:AssetLabel$>
</mt:NameParseComponents>
outputs “Flinstone, Frederick J.”
Supported components: precursor, title1, title2, givenname1, givenname2, initials1, initials2, middlename, conjunction1, conjunction2, surname1. surname_2, suffix
case_all_reversed text filter
The reversed name is returned as surname followed by a comma and the rest of the name.
Particularly useful for sorting, there is a text filter specifically for that:
<$mt:AssetLabel convert_breaks="0" filters="case_all_reversed"$>
outputs “Flinstone, Frederick J.”
The case_all_reversed method converts the first letter of each component to capitals
and the remainder to lower case, with the following exceptions-
initials remain capitalised
surname spelling such as MacNay-Smith, O'Brien and Van Der Heiden are preserved
- see C<surname_prefs.txt> for user defined exceptions
Example Usage: Create an image gallery sorted by last name
A recent branch of mt-plugin-Order (called items_per_row) allows for setting items_per_row in the mt:Order tag. The items_per_row attributethen enables mt:OrderRowHeader and mt:OrderRowFooter tags.
When used with the NameParse plugin, an image gallery cane be produced in rows of 3 (or 4 etc), and sorted by the last name, parsed from the AssetLabel.
<mt:Order sort_order="ascend" items_per_row="3">
<mt:OrderRowHeader><div class="gallery"></mt:OrderRowHeader>
<mt:OrderRowFooter></div></mt:OrderRowFooter>
<mt:Assets type="image" tag="gallery">
<mt:OrderItem>
<mt:setvarblock name="order_by">
<$mt:AssetLabel convert_breaks="0" filters="case_all_reversed"$>
</mt:setvarblock>
<dl>
<dt><img src="<$mt:AssetThumbnailURL width="144"$>" /></dt>
<dt>
<mt:NameParseComponents given_name_1="1" surname_1="1">
<$mt:AssetLabel$>
</mt:NameParseComponents>
</dt>
<dd><$mt:AssetDescription convert_breaks="0" filters="__default__"$></dd>
</dl>
</mt:OrderItem>
</mt:Assets>
</mt:Order>
Credits
Kim Ryan, author of Lingua::EN::NameCase
Damian Conway, author of Parse::RecDescent
UploaderPrefs Plugin for Melody and MT4
UploaderPrefs for Melody and Movable Type allows customization of the default options involved in uploading files and images.
WHY
I don’t like the default “Asset Upload” default options, which is to create a new entry, and to place the file in the root directory.
USAGE
Set your preferences in the plugin settings. Currently it supports two options, which can be set independently:
CREATE ENTRY WITH FILE OPTION
The plugin default is for the “Create new entry with file” option to be deselected. (Melody’s default is for that checkbox to be selected).
ASSET UPLOAD DIRECTORY
The MT default option is the site or archive root. UploaderPrefs default path is based on the date.
These options may also be over-ridden within the upload dialogue.
INSTALLATION
Drop the contents of the “plugins” directory into your application’s (Melody or MT) plugin directory.
TO DO
I’d like to add other options, such as a default directory.
DOWNLOAD
Get UploaderPref version 0.2 for Melody/Movable Type, or download the latest from github.
COPYRIGHT AND LICENSE
The software is released under the Artistic License. The terms of the Artistic License are described at http://www.perl.com/language/misc/Artistic.html .
Thanks to François Nonnenmacher for code lifted from his AssetDuJour plugin.
Except where otherwise noted, UploaderPrefs is Copyright 2011, Rick Bychowski, rick@hiranyaloka.com for Hiranyaloka. All rights reserved.
SortCatFld plugin for Melody & MT4
SortCatFld for Melody is an adaption of Hajime Fujimoto’s excellent SortCatFld plugin for MT4. The plugin was restructured to work with Melody. It will also work with Movable Type 4 (ConfigAssistant plugin required).
What It Does
This plugin does exactly what the original plugin does, which is to allow for custom sorting of categories and folders in your templates. This version is adapted to be compatible with Melody.
Requirements
The SortCatFld plugin for Melody and Movable Type 4 requires the ConfigAssistant plugin (which is included with Melody but not MT4).
Installation
Download SortCatFld for Melody & MT4 from GitHub. Place the contents of the “plugins” directory into your Melody or MT4 plugins directory.
Usage
The plugin adds a new sort_method to your SubCategories, TopLevelCategories, SubFolders, and TopLevelFolders tags. So for example, to allow custom ordering of Top Level Categories in a template, modify the template code:
<mt:TopLevelCategories sort_method="SortCatFld::Sort">
<!-- your template code here -->
</mt:TopLevelCategories>
The affected template code will now respond to the custom ordering of your folders and categories. You actually change the order of the categories/folders by clicking by going to “Manage Categories” or “Manage Folders” section of the application dashboard, and clicking on the “Sort Categories” or “Sort Folders” link at the top of the form.
Original Author and License
- Author: Hajime Fujimoto
- Description: Sort categories and folders as you like.
- Author Link
- Documentation Link
Licenses - This plugin will provide you with a dual license as follows.
When combined with the MT 5-1 commercial license license / personal: - You can safely modify and redistribute freely made. However, if you want to redistribute and modify, the original credits, please remain. - You can use for free. However, for your support for the development and support of plug-ins,donations would appreciate your consideration. When combined with 5-2.MTOS - Follow the GPLv2. - You can use for free. However, for your support for the development and support of plug-ins,donations would appreciate your consideration
TemplateSelector plugin
I’m pleased to announce a new plugin for Melody (and MT4 with the latest ConfigAssistant plugin). TemplateSelector extends entries and pages with a new “TemplateSelector” custom field. The “TemplateSelector” tag can output the name of any template in your blog.
USAGE
Within entry or page context of a template, use the tag to include a template by name:
<mt:Include name="<mt:TemplateSelector>">
Or perhaps use the tag to set a variable:
<mt:If tag="TemplateSelector">
<mt:TemplateSelector setvar="my_template_name">
</mt:If>
Then later in that template set a custom stylesheet:
<link id="my_custom_layout" rel="stylesheet"
ref="<mt:Link template="$my_template_name">"
type="text/css" media="screen" />
Setting The Tag Value
Simply select a template name from a pull-down menu within the “edit entry/page” form.
TEMPLATE SELECTOR MENU BUILDER
TemplateSelector can automatically search and present your entire list of templates. You probably don’t want to present your entire list of templates in the selection menu, so the Preferences::Plugin Settings::TemplateSelector form presents three options to narrow down the list. The resulting list is the result of an intersection of the three options (e.g. List = Type AND Outfile AND Name).
The resulting template list is then used to build the Template Selector Default Form (on plugin options page) and the Template Selector form on each “edit entry/page” form.
Plugin Options Screenshot
The TemplateSelector plugin options form (click for popup):
Template Type (optional)
Select from a single template type, or choose blank to return all types (blank is default).
- index - an Index Template
- archive - an Archive Template
- category - also an Archive Template
- individual - also an Archive Template
- custom - a Template Module.
- comments - a Comment Listing Template
- comment_preview - a Comment Preview Template
- comment_error - a Comment Error Template
- popup_image - an Uploaded Image Popup Template
- BLANK - returns all types (default).
Index Template Outfile (optional - requires Index type selection)
When the Index type is active, this text field matches against the Index Template Outfile path/name (precisely as shown in the “Design::Themes” panel of your blog’s dashboard). Allows only certain characters (see below). Supports any combination of percent ‘%’ and ‘_’ wildcards. For example:
- ’%.css’ matches index style sheets.
- ‘archives/%’ matches any index templates with outfiles written to your blog root archives directory.
Template Name (optional)
A simple text field matching the template name(s). Practically useful only when used with the wildcard characters (otherwise you can only possibly match a single template).
- Entry% - matches ‘Entry’, ‘Entry Monthly’, and ‘Entry Listing’.
- FooBa% - matches ‘FoodBar’, ‘FootBall’, ‘FooBar’, etc.
Allowed Characters for Outfile and Name fields
- Word characters - alphanumeric plus underscore.
- Whitespace - allowed (optionally trim trailing/leading whitespace).
- Symbols (outfile) - Hyphen ‘-‘, period ‘.’, and forward slash ‘/’.
- Symbols (name) - Hyphen ‘-’ and period ‘.’ .
- Wildcard - Percent ‘%’ matches any characters, underscore “_” matches a single character.
Trim Leading/Trailing Whitespace checkbox
When checked, leading/trailing whitespace will be trimmed from the Outfile and Name fields. Default is checked.
Blank Selection (Type, Outfile, and Name)
The default selection is blank. Leaving all three fields blank will (theoretically) return all templates on your system. However, the template list size limit is twenty (see BUGS section below).
TEMPLATE SELECTOR DEFAULT VALUE
After saving the three menu builder options, the “Set Default Template” menu will update the list of templates available in the “Set Default Template” field in the plugin options page. So it doesn’t make sense to attempt to change the “Menu Builder” and “Default Template” values at the same time (although in fact they are saved in the same form, see TO DO section).
ENTRY/PAGE TEMPLATE SELECTOR
Template Selector surfaces a dropdown list populated with the templates derived from the plugin options. New entries/pages will be provided the default selection option from the plugin options page.
Entry Form Screenshot

INSTALLATION
Download the latest TemplateSelector from GitHub. To install this plugin follow these instructions.
DEPENDENCIES
Melody or Movable Type 4 with ConfigAssistant 2.1.33 or above. (ConfigAssistant 2.1.33 added the options basename to the option_hash for callbacks).
Support, Feedback, Bugs, Feature Requests, ToDo
I would like to hear about your experience with TemplateSelector. Leave a comment on this page or email me at rick@hiranyaloka.com.
Known Bugs
- My testing has revealed that only the first 20 templates are exposed in the selection form, regardless of how many template names are fed to the Template Selector default value form. I’m open to suggestions to fix that.
- Initial setting of the template “Type” field to “Index” at the same time as setting the Template “Outfile” option (in plugin settings) returns no templates to the list. The fix is to set the Template “Type” option by itself and subsequently add the Template “Outfile” option.
Road Map
- Changes to the menu builder and default template options are submitted at the same time (with a single “Save Changes” button). Because the former affects the latter, it makes more sense to submit them separately (i.e. separate “Submit” buttons).
- Show error message when unsupported characters are entered in the Template Outfile or Template Name text field options.
- Allow for multiple values: <mt:TemplateSelector name=”foo”> .
- Extend other Melody objects: <mt:TemplateSelector object=”Category” name=”bar”> .
THANKS
Thanks to Byrne Reese and the Melody team for ConfigAssistant and other valuable support.
COPYRIGHT AND LICENSE
The software is released under the Artistic License. The terms of the Artistic License are described at http://www.perl.com/language/misc/Artistic.html .
Except where otherwise noted, TemplateSelector is Copyright 2011, Rick Bychowski, rick@hiranyaloka.com for Hiranyaloka. All rights reserved.
Download TemplateSelector:
https://github.com/Hiranyaloka/melody-plugin-template-selector
Hiranyaloka
Web Design
285 Countryhaven Rd.
Encinitas, CA 92024
(760) 487-8836
rick@hiranyaloka.com
Software
- MoreData Plugin for Movable Type
- NameParse Plugin for MT4 and Melody
- UploaderPrefs Plugin
- SortCatFld plugin
- TemplateSelector plugin
