Help - Search - Members - Calendar
Full Version: Textile and Smileys
Movable Type Community Forum > Additional Resources > Tips and Tricks
milk
When using Textile instead of Convert Line Breaks, smiley hacks are broken. It seems that posts are not parsed through Util.pm when using Textile. Instead they are parsed through textile.pm.

I am curious what is the equivelant text to replace in textile.pm? I am currently editing sub html_text_transform in Util.pm
kadyellebee
Which method of smilies hack are you using?  The Macros plugin method seems to work in entries where I've used Textiles in testing, but I haven't done extensive testing with it.

Kristine
milk
I performed the hack a long time ago, but here is what I had to do to perform is.

I had to edit edit_entry.tmpl and Util.pm.

In Util.pm, I put the following code:
CODE
sub html_text_transform {
   my $str = shift;
   $str ||= '';
    $str =~ s/\:angry:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/angry.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:grin:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/grin.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:blah:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/blah.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:confused:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/confused.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:hrmph:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/hrmph.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:cry:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/cry.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:evil:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/evil.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:glasses:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/glasses.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:hug:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/hug.gif\" width=\"27\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:laugh:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/laugh.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:mad:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/mad.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:ooo:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/ooo.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:rmad:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/rmad.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:rolleyes:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/rolleyes.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:sad:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/sad.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:frown:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/sad.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:shocked:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/shocked.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:sleep:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/sleep.gif\" width=\"27\" height=\"25\" alt=\"\" \/>/g;
    $str =~ s/\:zzz:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/sleep.gif\" width=\"27\" height=\"25\" alt=\"\" \/>/g;
    $str =~ s/\:smile:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/smile.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:suspicious:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/suspicious.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:tongue:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/tongue.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:vconfused:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/wconfused.gif\" width=\"15\" height=\"25\" alt=\"\" \/>/g;
    $str =~ s/\:wconfused:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/wconfused.gif\" width=\"15\" height=\"25\" alt=\"\" \/>/g;
    $str =~ s/\:whimper:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/whimper.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
    $str =~ s/\:wink:/<img src=\"http:\/\/www.toomuchsexy.org\/emoticons\/wink.gif\" width=\"15\" height=\"15\" alt=\"\" \/>/g;
   my @paras = split /\r?\n\r?\n/, $str;
   for my $p (@paras) {
       if ($p !~ m/^<(?:table|ol|ul|pre|select|form|blockquote)/) {
           $p =~ s!\r?\n!<br />\n!g;
           $p = "<p>$p</p>";
       }
   }
   join "\n\n", @paras;
}


In edit_entry.tmpl I put the following code:
CODE
<script language="javascript">
if (document.selection) {
   document.write('<table border="0" cellspacing="0" cellpadding="0" width="107">');
   document.write('<tr>');
   document.write('<td width="75"><a href="http://www.toomuchsexy.org/smileykey.php" onclick="OpenSmilies(this.href); return false">Smiley Key</a></td>');
   document.write('<td width="24"><a href="javascript:formatStr(\'b\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/bold-button.gif" alt="bold" width="24" height="18" border="0"></a></td>');
   document.write('<td width="24"><a href="javascript:formatStr(\'i\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/italic-button.gif" alt="italic" width="24" height="18" border="0"></a></td>');
   document.write('<td width="24"><a href="javascript:formatStr(\'u\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/underline-button.gif" alt="underline" width="24" height="18" border="0"></a></td>');
   document.write('<td width="26"><a href="javascript:insertLink()"><img src="<TMPL_VAR NAME=STATIC_URI>images/url-button.gif" alt="link" width="26" height="18" border="0"></a></td>');
   document.write('</tr>');
   document.write('</table>');
} else {
   document.write('<table border="0" cellspacing="0" cellpadding="0" width="75">');
   document.write('<tr>');
   document.write('<td width="75"><a href="http://www.toomuchsexy.org/smileykey.php" onclick="OpenSmilies(this.href); return false">Smiley Key</a></td>');
   document.write('</tr>');
   document.write('</table>');
}
</script>
kadyellebee
After looking at this a bit more, I'm pretty sure that any method that modifies Util.pm is only going to work if convert_breaks is turned on.  You might search around the forums and see if there's another method that would work with the clickable smilies bar on your entry edit screen.

Kristine
milk
QUOTE
After looking at this a bit more, I'm pretty sure that any method that modifies Util.pm is only going to work if convert_breaks is turned on.  You might search around the forums and see if there's another method that would work with the clickable smilies bar on your entry edit screen.

Kristine

I think you are right, that is why I am asking:

What do I modify in textile.pm to get the same effect as my Util.pm modifications?
girlie
Maybe you could ask the author??
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.