Topic: HOWTO: Add more smilies

1. Copy the smilies you want to add/change to into img/smilies/.


2. Open up include/parser.php and locate row 32. Here you will find two rows of PHP code. One that starts with $smiley_text and one that starts with $smiley_img. Unmodified the rows should look like this:

$smiley_text = array(':)', '=)', ':(', '=(', ':D', '=D', ';)', ':x', ':rolleyes:');
$smiley_img = array('smile.png', 'smile.png', 'sad.png', 'sad.png', 'big_smile.png', 'big_smile.png', 'wink.png', 'mad.png', 'roll.png');


3. For every new smiley that you want to add, add a character combination to $smiley_text and a filename to $smiley_img. Say you wanted to add a smiley for the character combination :cool: and that this combination would be replaced by the image cool.png, the result would be as follows:

$smiley_text = array(':)', '=)', ':(', '=(', ':D', '=D', ';)', ':x', ':rolleyes:', ':cool:');
$smiley_img = array('smile.png', 'smile.png', 'sad.png', 'sad.png', 'big_smile.png', 'big_smile.png', 'wink.png', 'mad.png', 'roll.png', 'cool.png');

Please note that you have to escape the character ' (singlequote) with a backslash if you use it in any of your smilies. I.e. ':rock\'n\'roll:'. Singlequote must be escaped so that PHP can understand that it is not the end of the string, but a character in the string. The same goes for backslash. If your smiley contains a backslash, just must escape that backslash with another backslash. I.e. ':\\'.


4. After you have added your smilies to $smiley_text and $smiley_img you should have a look at the row directly below. It says that you must uncomment the next row if any of your smilies contain any of the characters &, ", ', < or >. Uncommenting is done by removing the two slashes in the beginning of the row

//   $text = array_map('htmlspecialchars', $text);


5. Voila!

"Programming is like sex: one mistake and you have to support it for the rest of your life."

2

Re: HOWTO: Add more smilies

Are there any smiley packs available?

3

Re: HOWTO: Add more smilies

The problem it's if you upload a smile bigger than 15x15....

4

Re: HOWTO: Add more smilies

JuanLlanos wrote:

The problem it's if you upload a smile bigger than 15x15....

Sorry!!! I see it in the FAQ.

5

Re: HOWTO: Add more smilies

Hi,You should add more smileys.

Re: HOWTO: Add more smilies

Maybe something to add to the HOWTO.

- If you have smilies uploaded that are larger then 15 15 pixels, you still see the smilies(for example 30 30 pixels) in 15 15 in help.php(click Smilies under Message).

- To change this: GO TO LINE 162 in help.php . Remove width="15" height="15".

Re: HOWTO: Add more smilies

the bad thing about removing width and height is that you then no longer follow the w3c standard for valid html ... instead you hope that the browser will figure it out ...

better is to mod the code, and add two more arrays, one for height and one for width ... and pick the values from those ... then you won't break the html standard validity ....

Re: HOWTO: Add more smilies

Well, I use the WC3 standard for my site, but with Forums it is good enough if it works.

But how can you change files without harming the WC3?

Re: HOWTO: Add more smilies

W3C, not three WCs. big_smile

[img]http://www.famfamfam.com/lab/icons/silk/icons/error.png[/img] /me speaks French and bad English [img]http://www.famfamfam.com/lab/icons/silk/icons/error.png[/img]

Re: HOWTO: Add more smilies

I did all you said but still can't make it work, the smilie still is 30x30

And if the night runs over,
And if the day wont last,
And if the way should falter along the stony pass
It's just a moment, this time will pass!!

Re: HOWTO: Add more smilies

555|STi wrote:

I did all you said but still can't make it work, the smilie still is 30x30

I'm quoting the FAQ:

To use non-15x15 pixel smilies, you must prevent PunBB from  adding the width="15" and height="15" attributes to img tags.  This can be done by editing include/parser.php in a text  editor. Open up the file and search for:

width="15" height="15"

The text should be somewhere around line 260. Then replace  the values with a width and height of your choice. If you want  to use smilies of varying sizes, remove the attributes  completely.

Re: HOWTO: Add more smilies

It's an old message. neutral

Sorry for my french english.
GT4 Club driver France & Forum - Lingerie.

13

Re: HOWTO: Add more smilies

On the newest version, which file schould I open to change or include smileys?

14

Re: HOWTO: Add more smilies

the same as what the first post says

15

Re: HOWTO: Add more smilies

it is there.
look in your forum folder. then the folder called "include" then there is a file called parser.php

16 (edited by vibien 2005-07-21 18:06)

Re: HOWTO: Add more smilies

I install again and I find it, thank you very much Mark

17 (edited by Prozac 2006-01-27 03:00)

Re: HOWTO: Add more smilies

Hi !
I have just installed and configured my PunBB.
PunBB is really great. I used to work with SMF and other great open-source discussion boards but PunBB is the first which is so thoroughly coded.
I really like its code. No disgusting tables, just a beautiful and clear code.
This is my first post here so let me express my admiration for this great project. I hope the author will be able to read this. Sometimes THANKS are more valuable than any money.

Frank H wrote:

the bad thing about removing width and height is that you then no longer follow the w3c standard for valid html ... instead you hope that the browser will figure it out ...

better is to mod the code, and add two more arrays, one for height and one for width ... and pick the values from those ... then you won't break the html standard validity ....

Well, as I know a W3C specification requires only alt attribute. The specification does not require width and height as obligatory attributes.
I have just removed all width and height attributes for PunBB smilies and run W3C validator which displayed a valid XHTML 1 Strict confirmation.

Greets,
Prozac

Greets,
Prozac

Re: HOWTO: Add more smilies

Better just remove width specifications. It'll resize to height specifications and still has the normal image ratio. Would be great for custom smilies smile


Oh, and maybe a better idea, put the smilies in the DB and make it possible to add/modify the smileys from the Admin CP easily.
For the smileys itself, maybe an upload form.

19

Re: HOWTO: Add more smilies

elbekko wrote:

Oh, and maybe a better idea, put the smilies in the DB and make it possible to add/modify the smileys from the Admin CP easily.
For the smileys itself, maybe an upload form.

Hi !
Yes, it's a good idea. But I'm sure the author has many such and other requests and this way he would have to build another heavy and slow CMS like SMF or something like that smile
On the other hand I think that PunBB will be great so long as it has only one author. Just look at other open-source CMS systems, discussion boards. They have a lot of various developers and contributors. This way we get a mix of HTML and PHP code - a dangerous blend which contains a lot of bugs.

Cheers !

Greets,
Prozac

Re: HOWTO: Add more smilies

Hrmm, I'm sure it wouldn't be too slow... I could easily write a pretty fast script (fast based on MySQL server performace that is) to do this.
Actually, I think I'm off to write a mod for this easyness tongue

21

Re: HOWTO: Add more smilies

elbekko wrote:

Hrmm, I'm sure it wouldn't be too slow... I could easily write a pretty fast script (fast based on MySQL server performace that is) to do this.
Actually, I think I'm off to write a mod for this easyness tongue

Indeed, I think writing a mod it a better idea than implementing such a feature to the original PunBB.
In my opinion PunBB should be as light as possible. If someone wants to add a new feature then he can just install a mod. If one mod doesn't work as it should, it has bugs or is very slow then we can just uninstall it.

Greets,
Prozac

Re: HOWTO: Add more smilies

I made the mod smile More info in this thread.

23

Re: HOWTO: Add more smilies

Thanks elbekko. I have just downloaded this plugin from here
Unfortunately there is something wrong with the files included in this ZIP archive. After unpacking I got AMP_Links_Moderate.php instead of AMP_Smilies.php yikes

Greets,
Prozac

Re: HOWTO: Add more smilies

Yes, I know, it should be fine now.

/me puts up banner Ban Windows to the sun!

Re: HOWTO: Add more smilies

Prozac wrote:

here

Any particular reason this link logs me out of punres on route... ?