Lazyman smileys (embedded)
I really liked the script that Jennifer put together for the Lazyman smileys (pop up version), but Melissa and I wanted the smileys to appear on the page next to the comment box instead of in a pop up window.
Don't forget, if you've upgraded to MovableType 2.6 or higher, you'll need to tweak your Sanitize settings so the images will display.
The smiles come from Jason's and were discovered by Melissa.
Note: I still use MTMacros because I want to be able to convert :) to the image version.
Updates:
» You must be running PHP in your blog (or you can PHP-parse your HTML files, but you get to look up how to do that yourself).
» The easiest way to implement these smileys is to use the Individual Entry Archives as your comment entry form instead of using the comment popup window. This is easy to change. You'd swap out the following:
<a href="<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>" onclick="OpenComments(this.href); return false">Comments (<$MTEntryCommentCount$>
</a>
for:
<a href="<$MTEntryLink$>#comments">Comments (<$MTEntryCommentCount$>
</a>
If you're really stuck on the comment popup, send me email and I'll write up a workaround.
1) Take the following code and paste it into a new Index Template (text version for download):
<?
$smiliepath = "/images/smiles/";
$serverPathToSmilies = "/path/to/your/images/smiles/";
?>
<script language="javascript">
<!--
function writeImgTag(code, w, h)
{
var cache = document.comments_form.text.value;
this.code = code;
document.comments_form.text.value = cache + " <img src='<? echo $smiliepath; ?>" + code + "' width='" + w + "' height='" + h + "'> ";
document.comments_form.text.focus();
}
//-->
</script>
<?php
$cellcount=0;
if ($handle = opendir($serverPathToSmilies)) {
while (false !== ($file = readdir($handle))) {
$retVal[count($retVal)] = $file;
}
closedir($handle);
sort($retVal);
for ($xx=0; $xx < count($retVal); $xx++) {
if (substr($retVal[$xx], -4) == ".gif") {
$size = getimagesize($serverPathToSmilies . $retVal[$xx]);
$name = substr($retVal[$xx],0,(strpos($retVal[$xx],".gif")));
$width = $size[0];
$height = $size[1];
echo "<img onClick=\"writeImgTag('".$retVal[$xx]."','".$width."','".$height."')\" src=\"".$smiliepath.$retVal[$xx]."\" width=\"".$width."\" height=\"".$height."\" alt=\"".$name."\" title=\"".$name."\" border=0> ";
}
}
}
?>
<br /><br />
Fix the following: $smiliepath (This is the URL to your images; you could put http://www.yourserver.com/images/smiles/ if you want to have the full path for your images), $serverPathToSmilies (this is the directory on the server where the smileys live).
Also, make sure that your comment form is called "comment_form" or rename it in the code above. Ditto for "text" (this is the text box for comments).
2) Save this in the same directory that your images are in. On my server, this is images/smileys/index2.php (index.php is where I was playing with the pop up version).
3) Because I removed the table tags from the original PHP code, the images will "float" nicely on your page. Add the following to your comment form (either in your comment pop up windows or in the Individual Entry Archives template):
<?php include("/PATH/TO/images/smiles/index2.php"); ?>
4) Rebuild your site.
5) Test and have fun!
12 Comments
22 TrackBacks
Listed below are links to blogs that reference this entry: Lazyman smileys (embedded).
TrackBack URL for this entry: http://www.beantowngeek.com/cgi-bin/mt/mt-pong.cgi/160
One of the reasons I had taken smilies off my site was because I didn't like the look of all Read More
A few notes on my smilies and how I set them up. I had bigger smilies before that were purple Read More
Stuff for today: 1. Embed the smilies. I had a problem with this yesterday, and that's because I didn't put the absolute path in my archive template. Here is the parsing error: Warning: open_basedir restriction in effect. File is in... Read More
I spent some time today editing a few smilies that I found and making them more uniform. I created a spork smiley: ... for my posse. I also tweaked a hat and a beanie smiley I found: /images/lazymans/flowerhat.gif" alt="flowerhat" />... Read More
I spent some time today editing a few smilies that I found and making them more uniform. I created a spork smiley: /images/lazymans/spork.gif" alt="spork" /> ... for my posse. I also tweaked a hat and a beanie smiley I found:... Read More
I say, ok, smileys NOW! Gotta start from scratch, so I go over to the MT website to get into the support forums. But I never make it that far. The latest entry on MT is that they've been nominated... Read More
I say, ok, smileys NOW! Gotta start from scratch, so I go over to the MT website to get into the support forums. But I never make it that far. The latest entry on MT is that they've been nominated... Read More
I finally fell in and added smilies to my site. I am sorry though that I cannot have a comment pop-up window any longer. You will have to comment in... Read More
Added some clickable smilies to the comments page. Let me know what you think of em. I guess if I'm not careful, I may end up with too much stuff on my page. Nobody minds waiting for it, right? heh... Read More
ˬÌä¼Ô¤Î¥³¥á¥ó¥ÈÅê¹Æ¥Õ¥©¡¼¥à¤Ç¥¹¥Þ¥¤¥ê¡¼²èÁü¤ò»È¤¨¤ë¤è¤¦¤Ë¤·¤Æ¤ß¤Þ¤·¤¿¡£ º£²ó¤Î²þ¤¤Ë¤âȾÆü¤Û¤É¤«¤«¤Ã¤Æ¤·¤Þ¤¤¤Þ¤·¤¿¤¬¡£ ¥µ¥¤¥È¤Î¥Ç¥¶¥¤¥ó¤¬¹¥¤¤Ç»þ¡¹ÇÁ¤¤¤Æ¤¤¤¿ Lazyman smileys (embedded) - Glimpse of a Grrl ¤ò»²¹Í¤Ë¤µ¤»¤Æ¤â¤é¤¤¤Þ¤·¤¿¡£ ÀßÃÖË¡¤ò´Êñ¤ËÀâÌ... Read More
PHP¤ò»È¤Ã¤Æ¡¢Ë¬Ìä¼Ô¤Ë¤è¤ë¥³¥á¥ó¥ÈÆâ¤Ë¥¹¥Þ¥¤¥ê¡¼²èÁü¤òËä¤á¹þ¤à¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ MT¤Î¥¢¡¼¥«¥¤¥Ö¥Õ¥¡¥¤¥ë¤Î³ÈÄ¥»Ò¤¬.php ¤Ç¤¢¤ë¤³¤È¤¬Á°Äó¤Ç¤¹¡£ ³ÈÄ¥»Ò¤Î³Îǧ¡¦Êѹ¹¤ò¤¹¤ë¤Ë¤Ï¡¢´ÉÍý¼Ô²èÌÌ¢ªBLOG¤ÎÀßÄꢪ¥¦¥§¥Ö¥í¥°¤ÎÀßÄ꤫¤é¡Ö¥¢¡¼¥«¥¤¥Ö¤ÎÀßÄê¡×¤Î2ÈÖÌܤˤ¢¤ë³ÈÄ¥»Ò¡... Read More
Woo hoo again! :D I got the smilies working for the comments too... I might even go looking for some other smilies to add to them too. Let me know if there is any particular feeling you want to convey... Read More
this is my 200th post here at Simply Girly since Nov 10th 2003. I made my 100th post on Dec 17th 2003. I'm not so good with the counting, but I'm pretty sure that 100 posts in that time frame... Read More
this is my 200th post here at Simply Girly since Nov 10th 2003. I made my 100th post on Dec 17th 2003. I'm not so good with the counting, but I'm pretty sure that 100 posts in that time frame... Read More
I did a lot of work on the Goob this morning - got the streaming cam up and running with lots of help from Lisa. I still have to get ahold of her today to figure out the flash version... Read More
I did a lot of work on the Goob this morning - got the streaming cam up and running with lots of help from Lisa. I still have to get ahold of her today to figure out the flash version... Read More
I did a lot of work on the Goob this morning - got the streaming cam up and running with lots of help from Lisa. I still have to get ahold of her today to figure out the flash version... Read More
Lazyman smileys (embedded) - Glimpse of a Grrl... Read More
Cool. Mazeguy Smilies Speech Balloons CreatorFlash You can create your own speech balloons. There are several I plan to create. They'll have to go with my new set of smilies. :) [I've been meaning to implement some new smilies for... Read More





Thanks for this.. I've really wanted to add smilies *S*
Thank you for the credit link girlie. You're always so good at crediting your sources.
is this ok? (P.S. I do have a ""
Please help! I've been working on this for a couple of hours now but i can't figure it out!!
Has anyone done this successfully with pmachine? I would love to do it, but can't.
I would love to know how do you make it work in the comments pop-up page, since it's a .cgi extension.
If you have solution, please let us know
Beatriz: You don't. You can do the lazyman popup though. Sorry!
cute smileys!!!
I implemented the script and the smilies show up in my individual entry pages, but they don't show up in the actual comments. Any clue why? I've checked and can't seem to find what could be causing it.
Does anyone have problems with this messing up their site when viewed with Mozilla? I'm trying to figure out if it's the smilies or the live text preview that I just implemented. Whatever it is, something is making page all wonky in Mozilla.
Why do not I see me posts???