Emoticons

Creating and modifying plugins.
Post Reply
User avatar
Eni
Regular
Posts: 62
Joined: Thu Jan 27, 2005 11:47 pm
Location: Münster, Germany

Emoticons

Post by Eni » Thu Jan 03, 2013 7:50 pm

Hi,

I'd like to edit the Emoticate Event Plugin.

I want to use more emoticons than it makes sense to display on the comments form. What I would like to do is only show 10 emoticons and then a wider selection via a popup link.

Now, I know how to insert a target=blank link but I seem to not be able to figure out how to do that in the php script. This is how it looks now:

Code: Select all

if (!isset($this->smilies)) {
$ext = $this->get_config('extension', 'gif');
$this->smilies = array(

"\\*excited\\*"    => serendipity_getTemplateFile('img/emoticons/excited.'.$ext),
"\\*angry\\*"    => serendipity_getTemplateFile('img/emoticons/angry.'.$ext), 
"\\*faint\\*"    => serendipity_getTemplateFile('img/emoticons/faint.'.$ext), 
"\\*fear\\*"    => serendipity_getTemplateFile('img/emoticons/fear.'.$ext), 
"\\*happy\\*"    => serendipity_getTemplateFile('img/emoticons/happy.'.$ext), 
"\\*love\\*"    => serendipity_getTemplateFile('img/emoticons/love.'.$ext),   
"\\*sad\\*"    => serendipity_getTemplateFile('img/emoticons/sad.'.$ext), 
"\\*shock\\*"    => serendipity_getTemplateFile('img/emoticons/shock.'.$ext),       
 );
}
Let's say, I want every emoticon after "happy" to not show on the comment form but be available via a popup link. What would be the best way to archive this? Editing the serendipity_event_emoticate.php seem to either not work or I try it wrong.

~eni
Sorry, I'm Late. But I Got Lost On The Road Of Life.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Emoticons

Post by garvinhicking » Sat Jan 12, 2013 7:57 pm

Hi!

Weeeeell. This is not as easy as you might think.

Ideally, I would suggest you to use CSS to completely hide the emoticate instructions/listing. Then you use jquery or edit the commentform.tpl file manually to place exactly those emoticons there you want; there you could also add your custom popup HTML code.

The benefits to this: You don't need to edit any core files, so it's update-safe. Also you can customize any listing you want.

You could of course also edit the PHP file to add restrictions, but this is really cumbersome and would require some PHP knowhow for breaking out of foreach loops with counters, etc...

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Post Reply