WordPress.org

Ready to get started?Download WordPress

Forums

Clickable Smilies in comments. (67 posts)

  1. xardoz
    Member
    Posted 10 years ago #

    Hi,
    Think this would work on the main Post Entry page?

  2. mamabean
    Member
    Posted 10 years ago #

    I must be doing something wrong... when I click on a smilie, it tells me in the status bar that the page has errors and won't add the smilie. I also have a script on there to automatically blod, italicize and link text in comments... is it possibly conflicting with that?

  3. Anonymous
    Unregistered
    Posted 10 years ago #

    Hmm, I tried this and keep getting an
    error on line 50
    character 1
    Error: 'document.form.comment' is null or not an object
    code: 0
    when i click on any of the smilies

  4. mamabean
    Member
    Posted 10 years ago #

    Ahhhh.... I forgot about Zone Alarm. I bet that's my problem. Thanks! LOL

  5. southerngal
    Member
    Posted 10 years ago #

    Welcome! :) It's one of the first things I check when something won't load, like pop-ups! *LOL*

  6. southerngal
    Member
    Posted 10 years ago #

    I have used my code on the pop-up comments with no problems and no modifications to the code. Others have asked me to put the code in their comments and it works for them as well.

  7. Laughinglizard
    Member
    Posted 10 years ago #

    Sg, your code works wonderfully on the pop-up comments page. My modifications are designed for the main b2edit.php page, to enable smilies' clickability in blog entries. :-) Sorry, didnt mean to say your code did not work.

  8. southerngal
    Member
    Posted 10 years ago #

    :) Mmmmmmkay! I will have to put that code in my entries page, thanks! I guess I just read it wrong...

  9. jackiefg
    Member
    Posted 10 years ago #

    Southerngal, I tried using the code, but when the comments pop up, the text box shows the following inside it:
    End before:
    <div>Close this window.</div>
    <!-- // this is just the end of the motor - don't touch that line either :) -->
    <p class="credit">0.030 <cite>Powered by WordPress</cite>
    <script type="text/javascript">
    document.onkeypress = function esc(e) {
    if(typeof(e) == "undefined") { e=event; }
    if (e.keyCode == 27) { self.close(); }
    }
    </script>
    </body>
    </html>
    Is there some closing code missing so that it doesn't put it all inside the text box? Also, the smilies won't go in there while that code is there.
    Thanks.

  10. jackiefg
    Member
    Posted 10 years ago #

    Southerngal, hold on, I'm getting some of it now. In your code above, the "end before" wasn't part of the code, it was an instruction.
    However, even when I just replace the existing URL part with the code, I have to leave the submit button code that's existing, otherwise they have no place to submit their comments.
    But when I try to replace the code now, I still get this code within the text box:
    <input name="submit" type="submit" tabindex="5" value="Say it!" />
    </form>
    <div>Close this window.</div>
    <!-- // this is just the end of the motor - don't touch that line either :) -->
    <p class="credit">0.026 <cite>Powered by WordPress</cite>
    <script type="text/javascript">
    document.onkeypress = function esc(e) {
    if(typeof(e) == "undefined") { e=event; }
    if (e.keyCode == 27) { self.close(); }
    }
    </script>
    </body>
    </html>
    There's gotta be something I'm missing that stops the coding and leaves the textbox working and the submit. Do you know what I'm doing wrong?

  11. southerngal
    Member
    Posted 10 years ago #

    From the start body tag to the end body tag:
    <body>
    <?php /* this line is b2's motor, do not delete it */
    $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");
    $commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id");
    if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $commentstatus->post_password) { // and it doesn't match the cookie
    echo("

  12. ".get_the_password_form()."

");
}
else {
if ($comments) {
// this line is WordPress' motor, do not delete it.
foreach ($comments as $comment) {
?>
<!-- comment -->
<?php comment_text() ?>
<?php comment_type(); ?> by <?php comment_author_link() ?> <?php comment_date() ?> @ "><?php comment_time() ?>
<?php } // end for each comment
} else { // this is displayed if there are no comments so far
?>
No comments yet.
<?php } ?>
<b>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>" target="_blank">RSS feed for comments on this post.</b>
<b>Trackback URL:
<?php trackback_url() ?></b>
<?php
if ('open' == $commentstatus->comment_status) { ?>
Line and paragraph breaks automatic. Just hit enter twice to place a break between paragraphs.
<form action="b2comments.post.php" method="post" name="form">
<label for="author">Your name:</label>
<input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER["REQUEST_URI"]); ?>" />
<label for="email">Your email:</label>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
<label for="url">Your URL:</label>
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
Click on a smilie to add it to your comment!
<script language="JavaScript" type="text/javascript">
function emoticon(theSmilie) {
theSmilie = ' ' + theSmilie + ' ';
if (document.form.comment.createTextRange && document.form.comment.caretPos) {
var caretPos = document.form.comment.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? theSmilie + ' ' : theSmilie;
} else {
document.form.comment.value += theSmilie;
}
document.form.comment.focus();
theSmilie = '';
}
</script>
<?php
$newrow = 0;
$prev_val="";
asort($b2smiliestrans);
while (list ($key, $val) = each ($b2smiliestrans)) {
if($prev_val and $val==$prev_val) { }
else if(!$prev_val or ($prev_val and $val!=$prev_val)){
?>
<img src="<?php echo "$smilies_directory/$val"; ?>" alt="<?php echo $key; ?>" border="0" onclick="emoticon('<?php echo $key; ?>')" onmouseover="style.cursor='hand'" />
<?php
$newrow++;
if($newrow == 14) { //new row after specified number of smilies
echo '
';
$newrow = 0;
}
}
$prev_val = $val;
}
?>
<label for="comment">Your Comment:</label>
<textarea name="comment" id="comment" cols="40" rows="10" tabindex="4"></textarea>
<input class="button" type="submit" value="Say it!" />
</form>
<?php } else { // comments are closed ?>
Sorry, comments are closed at this time.
<?php }
} // end password check
?>
Close this window.
<?php // if you delete this the sky will fall on your head
}
?>
<!-- // this is just the end of the motor - don't touch that line either :) -->
<?php //} ?>
Powered by Word Press
<?php
// Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18)
?>
<script type="text/javascript">
document.onkeypress = function esc(e) {
if(typeof(e) == "undefined") { e=event; }
if (e.keyCode == 27) { self.close(); }
}
</script>
</body>

  • southerngal
    Member
    Posted 10 years ago #

    Hopefully this will help you Jackie and anyone else hunting for the template. :)

  • jackiefg
    Member
    Posted 10 years ago #

    That worked perfectly, madame. Thank you so much :)
    I did buy a book on php and mysql. It's fairly obvious I haven't finished it but also that it's not quite the book I need for this.

  • Anonymous
    Unregistered
    Posted 10 years ago #

    I don't understand how zone alarm has anything to do with it? Did I miss something because I'm getting the same error as the person with the...
    Error: 'document.form.comment' is null or not an object
    ...yes, I have my smilies on and placed it where it should be.

  • Kalirose
    Member
    Posted 10 years ago #

    Is there a way to get the clickable smiles to work in the comments when not using the pop-up? I have my weblog set so that the comments load in the main window. I tried just using the bit of code that made the smiles and putting it into b2comments.php and the smiles show up but when clicked they don't go into the comment field. I don't get an error but nothing happens.

  • Anonymous
    Unregistered
    Posted 10 years ago #

    I don't think it has anything to do with my zone alarm and I don't use the pop-up comments either. I use the one that loads in the main window too.

  • Laughinglizard
    Member
    Posted 10 years ago #

    Anonymous: Are you getting the Error: 'document.form.comment' even without using the hack we are discussing here? Even so, humor us and try disabling your Zonealarm to test the comments. Without knowing much about your situation or your problem makes us shoot in the blind. A link to your blog/comment area might help us get a better picture.

  • Shae
    Member
    Posted 10 years ago #

    a.k.a. anonymous - had a little time to register today :) Please, note I don't use the popup comments and I only get the error when I try to add the clickable smilies. Otherwise, everything works fine.
    1. Error: 'document.form.comment' is null or not an object
    2. I turned off my Zone Alarm and I still got the same error.
    3. I tried out the other smiley tutorial from the fplanque and that worked beautifully.
    URL: http://meowie.net/log/

  • Laughinglizard
    Member
    Posted 10 years ago #

    Ok Shae, I see your problem now, much more clear. I can replicate the problem on my blog as well. I am swamped at this moment but as soon as I have some time, I will look at it. :-)
    Peace

  • Alex King
    Member
    Posted 10 years ago #

    The selection.createRange() code that inserts at the cursor position only works in IE. You should steal the insertion code from the wp-quicklinks.js to make it cross-browser compatible.

  • Shae
    Member
    Posted 10 years ago #

    Thank You :) I really appreciate it!

  • Shae
    Member
    Posted 10 years ago #

    It works {{HUGS}} Thanks Mark!

  • Laughinglizard
    Member
    Posted 10 years ago #

    :-P you are very welcome! Spread the word about WP is all I ask in return!

  • Shae
    Member
    Posted 10 years ago #

    Sorry, but I forgot to ask you one last question about the smilies clickable hack :) heh
    Is their a way of controlling how many smilies show up and how can I edit the :code for smilies:? I know I had an old tagboard and I was able to change the smilies and codes via some smile.db file, but I don't know how to change it on this one. Do you know? If not, I'll just play around with it.
    Thanks again!

  • Laughinglizard
    Member
    Posted 10 years ago #

    Smilie code is translated according to the code (do a search for $b2smiliestrans) in b2vars.php inside your b2-include folder. If your smilie is an image in your simlies folder and the name corresponds inside your b2vars.php, it gets translated and shows up on your comments page.

  • Shae
    Member
    Posted 10 years ago #

    Okay. Thank You!

  • southerngal
    Member
    Posted 10 years ago #

    You are welcome, glad I could help! :)

  • Anonymous
    Unregistered
    Posted 10 years ago #

    I've installed WordPress and it works wondrefully!
    Well, almost. The only thing that does not work are the smilies. I can't even get them to show up in the regular blog postings. If I put in ;-) then I get ;-) on the blog page.
    I went into the admin settings page and put smilies to 'yes'. Any other stuggestions?
    This is a default install, no hacks.
    Thanks,
    Roger

  • southerngal
    Member
    Posted 10 years ago #

    Do you have your default path to the smilies correct? You can find that under options/general blog settings. Make sure you have that path correct or they will not show up. :)

  • Anonymous
    Unregistered
    Posted 10 years ago #

    I have checked out your suggestion and I do have the path correct:
    http://www.domainname.com/blog/b2-img/smilies
    I have double checked this on the server and in the code. It is correct.
    Any other suggestions are much appreciated.
    Thanks,
    Anon

  • 123

    Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.