Smilies in MT Blog and Comments

| | Comments (15) | TrackBacks (4)

!! This tutorial has not been updated since movable type version 2. It is most likely obsolete !!

 

So you want smilies in your MT blog and comments?

Requirements:
-- Movable Type, version 2.5 or higher
-- MT Plugin, MTMacro

1. First, you'll need to get the smilie graphics that you want. Save them all in a folder on your website.

(Here are a couple of good Smilie Websites: Crack Smilies, Smiling Faces, Mood Smiles )

2 . Download Brad Choates MTMacro and install it. (Here's a tutorial on how to use MT Macro to autolink frequently used text in entries! It's VERY handy!)

3 . Open up MT, go to Templates, and at the bottom of the page, Create a new Template Module and call it smilies. Open it up to modify it.


4 . Then comes the fun part. For each smile you want available on your blog and comments, you'll need to code this (So if you want to have 20 smilies available, you'll need to have this code in the smilies template module 20 times):
[code] [/code]

We'll go through this piece by piece.

name="______" (Put what you want to call the smilie. I always call it the same name as the graphic. So if my graphic is wink.gif, I put wink here.)

string="______" (Put what you want to use to call it in your blog. Then, whenever you type that specific phrase, it will replace it with the corresponding smilie. I used : : around all of my smilies, just in case I actually used some of the words that my smilies were called -- with the : : surrounding it, you know the smile is only going to show up where you want it to)

img src="_____" (I put the full URL of my smilies in. It's safer that way!)



5. This is all that goes in the template module. So save it and go back to the templates main page.

6. Now you'll need to modify each template (main, archive, comments) that you want to have the smilies work on -- which will basically be all of them, unless you don't mind your smilies not showing up on archive pages, etc. Open up each template either in MT, or in your outside editor, and place this line directly below your body tag:
[code][/code]

7. Now you'll need to edit each of these tags:

(In your main and archive templates)

Change <$MTEntryBody> to
<$MTEntryBody apply_macros="1"$>

Change <$MTEntryIfExtended> to

(And in your Comment Listing Templates)

Change <$MTCommentBody> to
<$MTCommentBody apply_macros="1"$>

(And in your Comment Preview Template)

Change <$MTCommentPreviewBody> to
<$MTCommentPreviewBody apply_macros="1"$>


8. Now you can finally rebuild.

9 . Blog a new entry and test out a smilie, to be sure it's all working properly. Then Comment on that entry and test out the smilies there.



Now you need to set up clickable smilies in your comments (so that visitors can see the graphics, click them and smilie will be added to their comment.) Just follow these quick instructions:

Add this javascript in the head of your comment and preview comment templates:
[code] [/code]


Next ... right above the message area in the comments, add in this code. For each smilie that you want available in your comments to be clicked, code this line:

[code]:smilename:[/code]

Here's a sample of how I've got the form in my comments listing template set up:
[code]

<$MTCommentScript$>" method=post>" name=entry_id>
   
Name
E-mail
Website
:wink:
Comments

4 TrackBacks

Listed below are links to blogs that reference this entry: Smilies in MT Blog and Comments.

TrackBack URL for this entry: http://www.silverberry.org/x/mt-tb.cgi/1599

smile! from Cathode Ray Coma - blog on March 20, 2004 3:37 PM

With a little help from this tutorial and five minutes 'work' in ms paint (no, really) I now have smilies on the blog :D More house hunting today - we looked at the most gorgeous flat! Not that much more... Read More

smile! from This Virtual Life on April 12, 2004 4:11 PM

With a little help from this tutorial and five minutes 'work' in ms paint (no, really) I now have smilies on the blog :D More house hunting today - we looked at the most gorgeous flat! Not that much more... Read More

My MT updates... from simplycute blog'd on September 1, 2005 1:12 PM

I am using del.icio.us [my del.icio.us] now. I got lots of awesome help and tips from Quick Online Tips. Also... Read More

This is a test entry for the new smilies available here... :smile: :angry: :kiss: :love: :sad: :dead: :wtf: :cry: All... Read More

15 Comments

Hi. I just thought I'd let you know I found your tutorial by searching for different ways to do smilies in Movable Type. I've been playing with it most of the day. LOL! I love new toys.

I can't quite get it right though. If I insert the MTInclude line specifying my new smile template module, I get a whole line of smilies that do nothing but sit there whereever I inserted that code. The comments entry template appears to be set up right, but nothing happens when I click a smilie AND/OR it doesn't work if I just type in the text for the string. Would it be possible that MT Macro is in the wrong place? I'm going to ask my host to move it up for me.

If you feel like stopping by and see if I've made any really obvious mistakes I'd appreciate it. :)

Hi i did your tutorial on the smiles, and they dont show up in my comments any ideas?

Thank you so much for this tutorial! Only one problem -- in my comments, you can click the smilies, and it inserts the smiley code into the comment portion of the form, but when you preview or post it, the smiley doesn't show up in the comment. Any suggestions?

First of all, AWESOME site. I visit it all the time :) Second of all, I followed this tutorial and it works fine except that the smilies aren't showing up in the comments. (like Ian and Emily). If you could email me or stop by and just give me a hint at what might be wrong I would really really appreciate it. Thanks.

Ian / Michelle / Emily
you can read the setup discussion here. I know its a bit late but I ran into the same issue of smilies not showing up in the comments.
Here (http://www.scriptygoddess.com/archives/001293.php) is a good discussion and moral of the story is
Check your weblog settings - specifically your preferences: sanitize spec setting. The default is to strip out img tags.
Try using the "use my settings" option and putting this in the text field:
i, a href target, b, br, p, strong, img src width height
That will allow italics, links, bold, line breaks, paragraph breaks, bold (via "strong" tag), and img tags...

hope this helps.

Just thought I'd stop by again (well, in truth I had to since I accidentally edited out my javascript LOL) and say how much I appreciate the simplicity of your tutorial. I used it almost exclusively once I found it and it was by far the easiest to follow. Thanks again!

Lisa

I need help! I did the smilies tutorial exactly how you said, and some of them work while others give me this weird result... instead of the smiley image appearing I get a broken image followed by a string of coding: /www.splintered-dreams.com/blog/emoticons/angry.gif" /> I double-checked all my urls and they are all correct. I re-installed and re-did everything and it's still doing this! Any ideas?

Nevermind, fixed it... for some reason my absolute url freaks it out, so I just put "blog/emoticons/smiley.gif" *shrug*

Friendship make prosperity more shining and lessens adversity by dividing and sharing it.

The server my site resides on crashed a few weeks and I was left to reinstall MT and everything. I went ahead and installed the new 3.1 version of MT and when I went to redo this smiley hack I noticed that in the comment listing template you no longer have the HTML for a form. Instead there's a tag that calls the form from another template and I was wondering if you knew what this template was named? I have searched and can't seem to find it so any help would be appreciated. :)

Came to this a bit late - but got your script loaded and it worked like a charm! Thanks so much for your tutorial - it was easy to follow!

I followed your tutorial and was amazed at the simplicity of it. You give such great instructions and the examples you provided as to where and how to copy & paste... super! Thank you so much. I'm so glad there are people like you in this world who takes the time to put things in plain understandable English instead of some off the wall code thing. Thank you again & again!:thumbsup:

:book: fantastic tutorial, i managed to get smilies working only if i type in the comments field the code example : smilietag : without space of course, but on the comments it wont show smilies to let you click :S look:
http://www.khaleel.co.uk/2005/10/welcome_to_khaleelcouk.php

hey can you help me please, the smilies wont show up, i dont know why ive put them in all right templates and stuff:arg:

never mind sorry for keep on posting they all work! thanks for a great tutorial:biggrin::biggrin:

Leave a comment

Archives

Pages

Powered by Movable Type 4.1

About this Entry

This page contains a single entry by Lacy published on July 26, 2003 4:18 PM.

Monster House was the previous entry in this blog.

Tiling 101 and Dangerous Liasons is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Flickr