View previous topic :: View next topic |
Author |
Message |
Benjy
Joined: 25 Jan 2002 Posts: 108 Location: Paris, France
|
Posted: Fri Aug 09, 2002 6:18 pm Post subject: B2 Smilies Hack v2.0 (for b2 0.6 pre3) |
|
|
Hi all!
With B2 0.6 pre3 have come BBcode and smilies, so my previous hack, however still useable, seemed to me a little useless...
So I made a v2, which lists each smiley and it's asociated BBcode, under the blog's textarea (I think it has been requested too but I ain't sure).
Now the coding part.
Edit b2edit.form.php and just below Code: | <textarea rows="9" cols="40" style="width:100%" name="content" tabindex="4" wrap="virtual"><?php echo $content ?></textarea><br /> | insert Code: | <br /><b>Smilies :</b><br />
<table bgcolor="#F0F0F0" cellspacing="0" cellpadding="0" border="0" width="99%" align="center" style="border: 1px solid #CCCCCC; padding: 2px; margin: 1px;">
<tr>
<?php
$i=0;
$prev_val="";
asort($b2smiliestrans);
while (list ($key, $val) = each ($b2smiliestrans)) {
if($val==$prev_val) echo "<br />$key\n";
else if($prev_val) {
echo "</font></td>\n";
$i++;
if($i==8) {
echo "</tr><tr>\n";
$i=0;
}
?>
<td><img src="<?php echo "$smilies_directory/$val"; ?>" onclick="emoticon('<?php echo $key; ?>')" onmouseover="style.cursor='hand'" /></td><td><font size="1"><?php echo $key; ?>
<?php
}
if(!$prev_val) {
?>
<td><img src="<?php echo "$smilies_directory/$val"; ?>" onclick="emoticon('<?php echo $key; ?>')" onmouseover="style.cursor='hand'" /></td><td><font size="1"><?php echo $key; ?>
<?php
}
$prev_val = $val;
}
?>
</font></td>
</tr>
</table><br /> |
Note: clicking on a smiley will add its first BBcode (if there are many ones associated to the same smiley).
Enjoy,
Benjy. |
|
Back to top |
|
 |
Fallen
Joined: 16 Mar 2002 Posts: 67 Location: Sao Paulo, Brasil
|
Posted: Fri Aug 09, 2002 9:14 pm Post subject: |
|
|
Great hack!
Just wondering...: is possible to put this in a popup, and call it from a button like the other bbcode buttons?
Many thanks!
Fallen _________________
http://crube.net |
|
Back to top |
|
 |
Benjy
Joined: 25 Jan 2002 Posts: 108 Location: Paris, France
|
Posted: Fri Aug 09, 2002 9:50 pm Post subject: |
|
|
Wait for v2.1
Benjy. |
|
Back to top |
|
 |
.Chris
Joined: 30 Apr 2002 Posts: 186 Location: Hawaii
|
Posted: Fri Aug 09, 2002 10:23 pm Post subject: |
|
|
Wow great job! |
|
Back to top |
|
 |
Mellissa
Joined: 17 Nov 2002 Posts: 29 Location: Malaysia
|
Posted: Sun Nov 17, 2002 7:23 pm Post subject: |
|
|
Great script I finally realized I was running the wrong version of b2. |
|
Back to top |
|
 |
Armitage
Joined: 28 Dec 2002 Posts: 14
|
Posted: Thu Jan 02, 2003 3:26 am Post subject: |
|
|
Does this hack not work on the newer version? I've tried it a few times and keep getting parse errors on line 123, which is...
if($val==$prev_val) echo "<br />$key\n";
I'm pretty sure its in the first part, but don't know enough about php ytet to fix it. |
|
Back to top |
|
 |
Benjy
Joined: 25 Jan 2002 Posts: 108 Location: Paris, France
|
Posted: Thu Jan 02, 2003 12:45 pm Post subject: |
|
|
Mmm... at that time it was fully working, and I don't why it wouldn't work any more now... btw, why don't you use a newer release ? |
|
Back to top |
|
 |
Armitage
Joined: 28 Dec 2002 Posts: 14
|
Posted: Thu Jan 02, 2003 7:41 pm Post subject: |
|
|
I'm using b2-0.6.1, only installed it a week or two ago. Is there a newer version of the hack? Has anyone else tried it with b2-0.6.1? |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1278 Location: Oregon
|
Posted: Thu Jan 02, 2003 11:02 pm Post subject: |
|
|
What changes did you make in the code? I don't see any significant changes. _________________ Michael P.
 |
|
Back to top |
|
 |
Armitage
Joined: 28 Dec 2002 Posts: 14
|
Posted: Sun Jan 05, 2003 7:12 am Post subject: |
|
|
That was the first time I even opened b2edit.form.php
after I got errors, I made that line spread over a few lines and I think something with one of the vars is causeing the error. |
|
Back to top |
|
 |
Benjy
Joined: 25 Jan 2002 Posts: 108 Location: Paris, France
|
|
Back to top |
|
 |
blog17
Joined: 28 Jan 2003 Posts: 144 Location: London, UK
|
|
Back to top |
|
 |
conga
Joined: 14 Feb 2003 Posts: 15 Location: CT
|
Posted: Sun Feb 16, 2003 1:23 pm Post subject: |
|
|
sorry to bring this back up, but when i put in the code, i get smilies from other site, where do i put the path to my smilies? |
|
Back to top |
|
 |
YankeeGrl
Joined: 10 Sep 2003 Posts: 3
|
Posted: Wed Sep 10, 2003 1:17 am Post subject: |
|
|
I really don't get this.. I dont have the b2edit.form.php.. I only have b3edit.php |
|
Back to top |
|
 |
epolady
Joined: 30 Jul 2002 Posts: 800 Location: Texas
|
Posted: Wed Sep 10, 2003 1:50 am Post subject: |
|
|
YankeeGrl wrote: | I really don't get this.. I dont have the b2edit.form.php.. I only have b3edit.php |
You should have a b2edit.form.php in your /b2-include folder. _________________ No more support from me. Goodbye!
Go upgrade to WordPress, you'll find better support there. |
|
Back to top |
|
 |
|