November 06, 2003

Install in Movable Type

Implementing the visually linked icons is practically the same as implementing smileys in Movable Type Website, it can be done in different ways just choose the one that suites you.
I opted here to a mod (hack). I can use ";w;" next to a link to other web site and it will get automatically replaced by the corresponding little image next to the link.

I've adapted the code from here Website passing by there Website :

Open The file in MTdirectory/lib/MT/

After making a backup for your file, look for:

"sub html_text_transform {
my $str = shift;
$str ||= '';"

and add those lines

  • $str =~s/\;a;/<img src=\"http:\/\/\/FOLDER\/a.png\" width=\"20\" height=\"16\"border=\"0\" alt=\"Audio\"\/>/g;
  • $str =~s/\;v;/<img src=\"http:\/\/\/FOLDER\/v.png\" width=\"20\" height=\"16\" border=\"0\" alt=\"Video\"\/>/g;
  • $str =~s/\;p;/<img src=\"http:\/\/\/FOLDER\/p.png\" width=\"20\" height=\"16\" border=\"0\" alt=\"Photo\"\/>/g;
  • $str =~s/\;w;/<img src=\"http:\/\/\/FOLDER\/w.png\" width=\"20\" height=\"16\" border=\"0\" alt=\"Website\"\/>/g;

Watch the escape "\" and don't forget to change "" "FOLDER" to their corresponding values or the image name if you're using your own images.

And now when typing ";a;" it get replaced by Audio

  • ";v;" by Video

  • ":p;" by Photo

  • ";w;" by Website

Here is some other ways to get visuallly linked :
You can use MTinclude tag (to include a file that you created before where there is the img tag and the url for your images) with the aid of the ProcessTags so you can use MT tags inside posts.
Otherwise get the help of bradchoate MTMacro. And if you need a solution for Greymatter if not try javascript's .

Posted by Alan at November 6, 2003 09:44 PM