Freely configurable automatic raplacement of textual emoticons by image tags.
Description
AutoSmileys is an easy to use and highly customizable macro environment
for Movable Type. It will replace self-defined text abbreviations by image tags
when your site is published or dynamically rendered, respectively. It may be applied
either within entries, comments, pages, or any other part of your site.
AutoSmileys works with both static and dynamic publishing and has been
tested with MT 4.2, MT 4.3, and MT 5.0 beta (Perl 5.8.8 / PHP 5.2.9).
(Dynamic publishing with AutoSmileys requires PHP5 in either case.)
Download AutoSmileys-0.9.zip, unzip it and copy the AutoSmileys
directory from the zip file into the plugins directory of your Movable Type installation.
Sign in to your Movable Type CMS.
For each blog you wish to use AutoSmileys in, select Design > Templates from the menu and open
the desired template for editing.
Within each of these templates, enclose the desired parts with the
<mt:AutoSmileys> ... </mt:AutoSmileys> block tag.
Republish your site.
So for instance, if you wish to have AutoSmileys replacement on your entry main body,
edit the Entry template as follows:
Anyway you may also put the whole HTML body inside the AutoSmileys tag.
This would also apply AutoSmileys to comments, since the Comments
module template is included into the Entry template.
Once you have installed AutoSmileys, sign in to your Movable Type CMS and open
the Tools > Plugins page. Whithin the AutoSmileys 0.9 panel, expand the
Settings tab. By default, it will look as follows:
On the top of the form you may define HTML tag names whose content will be ignored
in order to avoid inappropriate image tag placement.
The list beneath consists of text abbreviations (tokens)
and associated image source URLs.
You may change these entries as you like and you may also expand or shorten the list
by clicking on the [+] and [-]
links on the right hand side (JavaScript required).
The list may be expanded with up to 40 rows by default.
You may increase the related parameter
maxRows
by editing AutoSmileys.pl.
Remarks
Remember that MT tags are applied after any text filter you may have set up for
entries or comments.
Hence, text filters such as Textile and Markdown would
replace stuff like *lol* before
AutoSmileys has a chance to see it.
Also, note that tokens are recognized only in the way you have defined them
after standard HTML entity replacement has been applied.
That is, :-)
will be displayed as :-) but not replaced.
How it works
The heart of AutoSmileys is a regular expression, dynamically created from the
mappings of tokens to URLs defined as above. Once having these mappings collected within a Perl hash
called %mappings, it's built as follows:
On a reasonably valid markup code this will replace any tokens outside
markup tags, especially ignoring the content of specified tags
inapplicable for containing image tags.
Then,
does the job, using the following callback function:
Here, $Defaults->{image_tag}
is the actual image tag function.
That's it .
zora commented on 2009-12-06T16:13:41+00:00
cool
Guess which one is my favourite.
It is of course this one:
by zora
→ reply to comment