View previous topic :: View next topic |
Author |
Message |
Lisa-J
Joined: 30 Apr 2003 Posts: 6 Location: Liverpool, UK
|
Posted: Fri May 02, 2003 4:38 pm Post subject: Clickable smilies - tutorial found! |
|
|
I was searching on Google for a code that showed me how to edit my comments page in a way so that it would show clickable smilies (meaning, when someone wanted to leave a comment, they could click the smiley they wanted and the relevant code would appear in the text area). I found two tutorials, but the server for the first appears to be down, so I checked out this one instead. I got up to steps 3 & 4 when I got totally lost
Question is, could this work? Or are there easier ways of doing it? |
|
Back to top |
|
 |
Sargant
Joined: 20 Apr 2003 Posts: 14
|
Posted: Fri May 02, 2003 5:54 pm Post subject: |
|
|
That tutorial won't work, as it's not for b2 and not even in PHP
To include clickable smilies, try putting something like this into your b2edit.php page: Code: | <a href="javascript:window.document.post.content.value += ':)'">Smile</a> |
Copy this many times, and change the :) bit to whatever smiley you want. You can then change the "Smile" bit to describe the link - if you want, insert an <img> tag to show the actual smiley you want that corresponds to the text. _________________ I am all the things that you regret,
a truth that washes,
that learnt how to spell
another.blog @ sargant.com |
|
Back to top |
|
 |
Ruud
Joined: 12 Oct 2002 Posts: 77
|
Posted: Fri May 02, 2003 6:36 pm Post subject: |
|
|
This board is full of great stuff
Have a look at this post and if needed browse through that whole thread (many posts before that one).
Ruud |
|
Back to top |
|
 |
Lisa-J
Joined: 30 Apr 2003 Posts: 6 Location: Liverpool, UK
|
Posted: Fri May 02, 2003 7:30 pm Post subject: |
|
|
Neither of those work for me, I'm afraid. As for the latter one, it works okay to start with, but when I actually click a smiley, I get "Error on page" in the status bar, and nothing happens. |
|
Back to top |
|
 |
Ruud
Joined: 12 Oct 2002 Posts: 77
|
Posted: Fri May 02, 2003 7:46 pm Post subject: |
|
|
Have a look at the code in his site, maybe.
Ruud |
|
Back to top |
|
 |
annaweb
Joined: 03 May 2003 Posts: 3
|
Posted: Sat May 03, 2003 4:15 pm Post subject: |
|
|
Lisa-J wrote: | Neither of those work for me, I'm afraid. As for the latter one, it works okay to start with, but when I actually click a smiley, I get "Error on page" in the status bar, and nothing happens. |
I can't get it to work either... "error on page". But the smilies work just fine when I post.... but not for the comments |
|
Back to top |
|
 |
annaweb
Joined: 03 May 2003 Posts: 3
|
Posted: Sat May 03, 2003 6:14 pm Post subject: |
|
|
I got it to work!!!!!!
And this is what I did:
1. In "b2comments.php" Quote: | =====
Find
=====
<form action="<?php echo $siteurl; ?>/b2comments.post.php" method="post">
=====
=====
Replace with
=====
<form name="post" action="<?php echo $siteurl; ?>/b2comments.post.php" method="post">
===== ] |
2. Insert this code for smilies to appear:
Code: | <script language="JavaScript" type="text/javascript">
function emoticon(theSmilie) {
theSmilie = ' ' + theSmilie + ' ';
if (document.post.comment.createTextRange && document.post.comment.caretPos) {
var caretPos = document.post.comment.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? theSmilie + ' ' : theSmilie;
} else {
document.post.comment.value += theSmilie;
}
document.post.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 == 11) { //new row after specified number of smilies
echo '<br />';
$newrow = 0;
}
}
$prev_val = $val;
}
?> |
|
|
Back to top |
|
 |
Ruud
Joined: 12 Oct 2002 Posts: 77
|
Posted: Sat May 03, 2003 11:53 pm Post subject: |
|
|
Alright! I'll include those instructions later on at dawolfden.com.
Thanks for the time and effort!
Ruud |
|
Back to top |
|
 |
Lisa-J
Joined: 30 Apr 2003 Posts: 6 Location: Liverpool, UK
|
Posted: Sun May 04, 2003 2:52 pm Post subject: |
|
|
[quote="annaweb"]1. In "b2comments.php" Quote: | =====
Find
=====
<form action="<?php echo $siteurl; ?>/b2comments.post.php" method="post">
=====
=====
Replace with
=====
<form name="post" action="<?php echo $siteurl; ?>/b2comments.post.php" method="post">
===== ] |
I don't have that first part in my coding. I've tried two different methods of adding smilies, but each time all I get is "Error on page".
Here is some of the coding of my comments page:
Code: | <td bgcolor="#FF2BA3">
<div id="header"><a href="" title="/PRTTY.GRL*">/PRTTY.GRL*</a></div>
</tr>
</td>
</table>
<div id="contentcomments">
<div class="storyContent">
<br>
<!-- you can start editing here -->
<table style="border:1pt solid #384948" cellpadding="1" cellspacing="3" width="300" bgcolor="#FF2BA3" align="center">
<tr>
<td bgcolor="#FF2BA3">
<form action="b2comments.post.php" method="post">
<input type="hidden" name="comment_post_ID" value="12" />
<input type="hidden" name="redirect_to" value="/lisa/b2/b2commentspopup.php?p=12&c=1" />
<p class="commentfield">
name<br />
<input type="text" name="author" class="textarea" value="Vox" size="10" tabindex="1" />
</p>
<p class="commentfield">
email<br />
<input type="text" name="email" class="textarea" value="" size="10" tabindex="2" />
</p>
<p class="commentfield">
url<br />
<input type="text" name="url" class="textarea" value="http://www.digital-talent.net" size="10" tabindex="3" />
</p>
<p class="commentfield">
your comment<br />
<textarea cols="20" rows="4" name="comment" tabindex="4" class="textarea"></textarea>
</p>
<p class="commentfield">
<input type="checkbox" name="comment_autobr" value="1" tabindex="6" /> Auto-BR (line-breaks become <br> tags)<br />
<input type="submit" name="submit" class="buttonarea" value="ok" tabindex="5" />
</p>
<p class="centerP">
<br><br>
<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>
<b>/smilies*</b>
<br>
<img src="http://clever-girl.net/lisa/b2/b2-img/smilies/smile.gif" alt=":)" border="0" onclick="emoticon(':)')"/>
<img src="http://clever-girl.net/lisa/b2/b2-img/smilies/grin.gif" alt=":D" border="0" onclick="emoticon(':D')"/>
<img src="http://clever-girl.net/lisa/b2/b2-img/smilies/tongue.gif" alt=":P" border="0" onclick="emoticon(':P')"/>
<img src="http://clever-girl.net/lisa/b2/b2-img/smilies/sorry.gif" alt=":(" border="0" onclick="emoticon(':(')"/>
<img src="http://clever-girl.net/lisa/b2/b2-img/smilies/cry.gif" alt=":((" border="0" onclick="emoticon(':((')"/>
<img src="http://clever-girl.net/lisa/b2/b2-img/smilies/love2.gif" alt=":x" border="0" onclick="emoticon(':x')"/>
<img src="http://clever-girl.net/lisa/b2/b2-img/smilies/cool.gif" alt=":cool:" border="0" onclick="emoticon(':cool:')"/>
<img src="http://clever-girl.net/lisa/b2/b2-img/smilies/eyebrow.gif" alt=":brow:" border="0" onclick="emoticon(':brow:')"/>
<!-- smilies end -->
<br>
<a href="http://clever-girl.net/lisa/sub/smilies.html" target="_blank">more?</a>
<p class="centerP">
/powered by <a href="http://cafelog.com" target="_blank"><b>b2</b></a>*
</p>
</form>
</tr>
</td>
</table>
</div>
<!-- // this is just the end of the motor - don't touch that line either :) -->
</div> |
|
|
Back to top |
|
 |
|