Help - Search - Members - Calendar
Full Version: smilie bar comments
Movable Type Community Forum > Additional Resources > Tips and Tricks
xpliciotne
I saw the following posts about smilie bar comments and that you have to edit the Util.pm and the edit_entry.tmpl. but I was just wondering: I only want the smilies in my comments listing and preview DO I have to do the editing in the edit_entry.tmpl, can't i just do it alone in the Util.pm
then do what ever i have to do in the comment listing and preview.

and also
for this part where you have to add your smilies in the Util.pm
CODE
$str =~ s/\:angry/<img src=\"http:\/\/yoursite.com\/smilies\/angry.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;


you see where it has s/\:angry/
is it just s/\:angry or s/\:angry:/
im just curious coz after doing my mt smilies and getting use to :smilename: its just stick in my head


im using this tutorial
smiliebar

and for that string code do i have to set a width and height?
oscarf
You don't have to hack MT to put smilies in your comments. I never hack MT, only because I love to upgrade stuff and that always means re-hacking. I'm WAY too lazy myself.

There is a good Scriptygoddess smilies tutorial for putting them in via your templates (that is, clickable smilies for your guests, just not for you when you're editing posts).

Also, the ~ s/\:angry/ thing will give you ":angry"

If you want :angry: it would need to be ~ s/\:angry\:/

These // contain "angry" and the backslashes escape the colons, as they say wink.gif (sorry ...)
xpliciotne
I had use the tutorial given to me by oscarf but um its not showing in the comments now
i put one smilie in there just to test it

my comment preview template
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<$MTPublishCharset$>" />

<title><$MTBlogName$>: Comment Preview</title>
<link rel="stylesheet" href="<$MTBlogURL$>styles-site.css" type="text/css" />
</script>
<script language="javascript">
<!--
function writeImgTag(code)
{
var cache = document.comments_form.text.value;
this.code = code;
document.comments_form.text.value = cache + " <img src='/mt/smilies/" + code + ".gif'> ";
document.comments_form.text.focus();
}
//-->
</script>
</head>

<body>
<MTInclude module="smilies">
<div id="banner-commentspop">
<$MTBlogName$>
</div>

<div class="blog">

<div class="comments-head">Previewing your Comment</div>

<div class="comments-body">
<MTCommentPreviewBody apply_macros="1">
<span class="comments-post">Posted by <$MTCommentPreviewAuthorLink spam_protect="1"$> at <$MTCommentPreviewDate$></span>
</div>

<div class="comments-body">
<form method="post" action="<$MTCGIPath$><$MTCommentScript$>">
<input type="hidden" name="entry_id" value="<$MTEntryID$>" />
<input type="hidden" name="static" value="<$MTCommentPreviewIsStatic$>" />

<label for="author">Name:</label><br />
<input id="author" name="author" value="<$MTCommentPreviewAuthor encode_html="1"$>" /><br /><br />

<label for="email">Email Address:</label><br />
<input id="email" name="email" value="<$MTCommentPreviewEmail encode_html="1"$>" /><br /><br />

<label for="url">URL:</label><br />
<input id="url" name="url" value="<$MTCommentPreviewURL encode_html="1"$>" /><br /><br />
<img onClick="writeImgTag('asshole')" src="/mt/smilies/asshole.gif" border=0>

<label for="text">Comments:</label><br />
<textarea id="text" name="text" rows="10" cols="50"><MTCommentPreviewBody convert_breaks="0" encode_html="1" apply_macros="1"></textarea><br /><br />

<input type="submit" name="preview" value=" Preview " />
<input style="font-weight: bold;" type="submit" name="post" value=" Post " /><br /><br />

</form>
</div>

<div class="comments-head">Previous Comments</div>

<MTComments>
<div class="comments-body">
<$MTCommentBody$>
<span class="comments-post">Posted by <$MTCommentAuthorLink spam_protect="1"$> at <$MTCommentDate$></span>
</div>
</MTComments>

</div>
</body>
</html>


my comment listing template
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<$MTPublishCharset$>" />

<title><$MTBlogName$>: Comment on <$MTEntryTitle$></title>

<link rel="stylesheet" href="<$MTBlogURL$>styles-site.css" type="text/css" />

<script type="text/javascript" language="javascript">
<!--

var HOST = '<$MTBlogHost$>';

// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
   var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
   document.cookie = curCookie;
}

function getCookie (name) {
   var prefix = name + '=';
   var c = document.cookie;
   var nullstring = '';
   var cookieStartIndex = c.indexOf(prefix);
   if (cookieStartIndex == -1)
       return nullstring;
   var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
   if (cookieEndIndex == -1)
       cookieEndIndex = c.length;
   return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
   if (getCookie(name))
       document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
   var base = new Date(0);
   var skew = base.getTime();
   if (skew > 0)
       date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
   var now = new Date();
   fixDate(now);
   now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
   setCookie('mtcmtauth', f.author.value, now, '', HOST, '');
   setCookie('mtcmtmail', f.email.value, now, '', HOST, '');
   setCookie('mtcmthome', f.url.value, now, '', HOST, '');
}

function forgetMe (f) {
   deleteCookie('mtcmtmail', '', HOST);
   deleteCookie('mtcmthome', '', HOST);
   deleteCookie('mtcmtauth', '', HOST);
   f.email.value = '';
   f.author.value = '';
   f.url.value = '';
}

//-->
</script>
<script language="javascript">
<!--
function writeImgTag(code)
{
var cache = document.comments_form.text.value;
this.code = code;
document.comments_form.text.value = cache + " <img src='/mt/smilies/" + code + ".gif'> ";
document.comments_form.text.focus();
}
//-->
</script>
</head>

<body>
<MTInclude module="smilies">
<div id="banner-commentspop">
<$MTBlogName$>
</div>

<div class="blog">

<div class="comments-head">Comments: <$MTEntryTitle$></div>


<MTComments>
<div class="comments-body">
<MTCommentBody apply_macros="1">
<span class="comments-post">Posted by <$MTCommentAuthorLink spam_protect="1"$> at <$MTCommentDate$></span>
</div>
</MTComments>

<MTEntryIfCommentsOpen>

<div class="comments-head">Post a comment</div>

<div class="comments-body">
<form method="post" action="<$MTCGIPath$><$MTCommentScript$>" name="comments_form" onsubmit="if (this.bakecookie[0].checked) rememberMe(this)">
<input type="hidden" name="entry_id" value="<$MTEntryID$>" />

<div style="width:180px; padding-right:15px; margin-right:15px; float:left; text-align:left; border-right:1px dotted #bbb;">
    <label for="author">Name:</label><br />
    <input tabindex="1" id="author" name="author" /><br /><br />

    <label for="email">Email Address:</label><br />
    <input tabindex="2" id="email" name="email" /><br /><br />

    <label for="url">URL:</label><br />
    <input tabindex="3" id="url" name="url" /><br /><br />
</div>
<img onClick="writeImgTag('asshole')" src="/mt/smilies/asshole.gif" border=0>

Remember personal info?<br />
<input type="radio" id="bakecookie" name="bakecookie" /><label for="bakecookie">Yes</label><input type="radio" id="forget" name="bakecookie" onclick="forgetMe(this.form)" value="Forget Info" style="margin-left: 15px;" /><label for="forget">No</label><br style="clear: both;" />

<label for="text">Comments:</label><br />
<textarea tabindex="4" id="text" name="text" rows="10" cols="50"></textarea><br /><br />

<input type="button" onclick="window.close()" value=" Cancel " />
<input type="submit" name="preview" value=" Preview " />
<input style="font-weight: bold;" type="submit" name="post" value=" Post " /><br /><br />

</form>

<script type="text/javascript" language="javascript">
<!--
document.comments_form.email.value = getCookie("mtcmtmail");
document.comments_form.author.value = getCookie("mtcmtauth");
document.comments_form.url.value = getCookie("mtcmthome");
if (getCookie("mtcmtauth")) {
   document.comments_form.bakecookie[0].checked = true;
} else {
   document.comments_form.bakecookie[1].checked = true;
}
//-->
</script>
</div>

</MTEntryIfCommentsOpen>

</div>

</body>
</html>


my site
http://www.xplicitone.com/mt/
oscarf
I haven't had time to look closely, but make sure you go to your blog configuration->preferences, and change Sanitize Spec to "Use My Settings" and put these in there:
CODE
a href,b,br,p,strong,em,ul,li,blockquote,img src
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.