Implementing Smileys [SOLVED]

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
David_Geoffrey
Forum Members
Forum Members
Posts: 65
Joined: Tue May 22, 2007 10:05 pm

Implementing Smileys [SOLVED]

Post by David_Geoffrey »

Hi All,

I am trying to implement the Smiley module (v0.2.0) with the Forum Module (0.9.0). I have copied the modifier.smileys.php over to the plugins directory and put {content|smileys} into my template - replacing the {content} tag.

I then get this error message when I launch the page

Fatal error: Call to undefined function smarty_modifier_smileys() in /home/omqixooq/public_html/christchurchguildford/tmp/templates_c/%%79^79E^79E2D318%%template%3A24.php on line 55

If anyone can suggest what else I need to do, I would be very grateful. I realise that there is a lot more in the help, but I am afraid that I don't know php - my knowledge stops with HTML  :-\

I am running "1.2.4 Greenland" version of CMSMS

Thanks in advance for any help
Last edited by David_Geoffrey on Wed Mar 11, 2009 10:56 am, edited 1 time in total.
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Implementing Smileys

Post by tobik »

Please could you check if
1. Does your copied modifier.smileys.php have correct file permissions? It must be readable by the webserver process.
2. Is your smileys modifier working in plain content pages?
cyberman

Re: Implementing Smileys

Post by cyberman »

Smiley module is a little bit buggy - maybe this thread can help

http://forum.cmsmadesimple.org/index.ph ... l#msg71103
David_Geoffrey
Forum Members
Forum Members
Posts: 65
Joined: Tue May 22, 2007 10:05 pm

Re: Implementing Smileys

Post by David_Geoffrey »

Hi Tobik
Thanks for your reply
1) Yes I think it does - it has the same permissions as all the other php files in the plugin directory
2) I am not quite sure what you mean by plain content pages - but I tried the same {content|smileys} in a standard template (left simple nav + 1 col) and it doesn't show any errors ?? This must be a clue  ;D

Hi Cyberman

Thanks for that, I will try and see if I can work this out - I see that Tobik was the author of the solution there too.

Thanks
DG
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Implementing Smileys

Post by tobik »

I just realized that your error message complains about function smarty_modifier_smileys() but in modifier.smileys.php this function is called smarty_cms_modifier_smileys(). I am just guessing, but rename this function in modifier.smileys.php and give it a try.
David_Geoffrey
Forum Members
Forum Members
Posts: 65
Joined: Tue May 22, 2007 10:05 pm

Re: Implementing Smileys

Post by David_Geoffrey »

Hi Tobik

I'm sure that you are right with that naming change, but I got around it by updating everything instead and now the smileys are working fine. I should have done that in the first place.

But I have another question, if that's ok? Do you know how I get to show all all the smileys available above the text box - like there is on this forum?

Thanks
DG

***Edit*** Tobik - I have just looked at your http://www.tobik.de/gastbuch.html and that is just what I want to do - except in a forum!
Last edited by David_Geoffrey on Mon Feb 09, 2009 9:52 am, edited 1 time in total.
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Implementing Smileys

Post by tobik »

DG, have a look at Extensions > Smileys > Some Smileys. The Guestbook does show all this smileys above the textbox.
David_Geoffrey
Forum Members
Forum Members
Posts: 65
Joined: Tue May 22, 2007 10:05 pm

Re: Implementing Smileys

Post by David_Geoffrey »

Hi Tobik
Yes - I can get the smileys to work on the Guestbook now thanks to you - but it was the Forum that I wanted to show them in as well.

I can get the smiley to display in the Forum if you type ":- )" , but I wanted to show the sample smileys and "show smiley" link as well. The forum help doesn't seem to show how to do this, is it possible?

Thanks for all your help on this
DG
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Implementing Smileys

Post by tobik »

Well, don't know if the forum makes use of the smileys module.
David_Geoffrey
Forum Members
Forum Members
Posts: 65
Joined: Tue May 22, 2007 10:05 pm

Re: Implementing Smileys

Post by David_Geoffrey »

Ok, thanks Tobik.  :)
Anyone else tried this by any chance and got it working?
Cheers
DG
cyberman

Re: Implementing Smileys

Post by cyberman »

Have you tried to use the smiley modifier directly in your forum template?

E.g in topic template like {$entry->postings|smileys}
David_Geoffrey
Forum Members
Forum Members
Posts: 65
Joined: Tue May 22, 2007 10:05 pm

Re: Implementing Smileys

Post by David_Geoffrey »

Hi Cyberman
Sorry that I have not replied sooner to your posting, "real" work got in the way of my "hobby" work  ;D

I have not tried any direct modification of the forum templates, I am not a web developer and I get scared when changing code without exact instructions!

But as far as I can tell, by putting the smiley modifier in as you suggest, is the same as {content|smileys} in my main page template - which I have already got to work to replace text with smileys in forum postings.

What I really want to be able to do next, is use these functions within the forum:-

function GetSomeSmileys($wantedsmileys=array( ':)', ':(', ':D', ';)' ), $theme="default");Returns an array containing the smileys specified in the array $wantedsmileys, using in the specified theme. They are returned as an associative array in the same form as GetSmileyList() (see above).

function GetPopupExampleLink($linkcontent, $theme="default");
Return the html-code for a clickable link containing $linkcontent, which opens a samall popupwindow containing all smileys from $theme. If no $linkcontent is given a link containing "Show Smileys" is displayed.

As I said above I am a not a web-developer and I suspect that these questions are not really CMSMS questions, and therefore I know that I should not really be asking these questions here, but if anyone is feeling very kind and could explain how I call these functions from within the forum pages, I would be very grateful

Thanks
DG
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Implementing Smileys

Post by tobik »

David, create two user tags:

some_smileys

Code: Select all

$smileys = CMSModule::GetModuleInstance("Smileys");
if ($smileys != false) 
{
    $list = $smileys->GetSomeSmileys(explode(" ", ":) :( :D ;)"));
    if (count($list) > 0)
    {
    	echo "<span class=\"somesmileys\">";
    	foreach ($list as $smiley=>$url) 
    	{
    	    $smiley  = str_replace('"', """, $smiley); // escape " for proper HTML
    	    $jsparam = str_replace("'", "\'"    , $smiley); // escape ' for proper JS call
    	    echo "<a href=\"javascript:emoticon('$jsparam')\" title=\"$smiley\">$url</a>\n";
    	}
    	echo "</span>";
    }
} 
popup_smileys

Code: Select all

$smileys = CMSModule::GetModuleInstance("Smileys");
if ($smileys != false) 
{
	echo $smileys->GetPopupExampleLink("", "default", "emoticon");
}
In your content you can now call this tags by

Code: Select all

{some_smileys} {popup_smileys}
If the smileys are to be inserted by click into a textbox, then you must provide the JavaScript function emoticon. Just grep over the guestbook and you will find this.

Yes, you are right. At least the first user tag should be provided by the smileys module.
David_Geoffrey
Forum Members
Forum Members
Posts: 65
Joined: Tue May 22, 2007 10:05 pm

Re: Implementing Smileys

Post by David_Geoffrey »

Hi Tobik

I am very sorry that I have not got back to you on this. Thank you very much for the two UDTs, but I am still having some problems. The popup_smileys works fine, although I am struggling with trying to get the inserting back into the textbox working.

But the bigger problem is the show_smileys tag. I have created and entered this into the template, but when it is displayed this is what is seen on the page

')" title=" ;D">" title=" ;D" /> ')" title=" ;D">"

for each of the example smileys

The source looks like this

Code: Select all


<span class="somesmileys"><a href="javascript:emoticon('<img src="modules/Smileys/themes/msn/msn_smiley.png" alt=":)" title=":)" />')" title="<img src="modules/Smileys/themes/msn/msn_smiley.png" alt=":)" title=":)" />"><img src="modules/Smileys/themes/msn/msn_smiley.png" alt="<img src="modules/Smileys/themes/msn/msn_smiley.png" alt=":)" title=":)" />" title="<img src="modules/Smileys/themes/msn/msn_smiley.png" alt=":)" title=":)" />" /></a>
<a href="javascript:emoticon('<img src="modules/Smileys/themes/msn/msn_sad.png" alt=":(" title=":(" />')" title="<img src="modules/Smileys/themes/msn/msn_sad.png" alt=":(" title=":(" />"><img src="modules/Smileys/themes/msn/msn_sad.png" alt="<img src="modules/Smileys/themes/msn/msn_sad.png" alt=":(" title=":(" />" title="<img src="modules/Smileys/themes/msn/msn_sad.png" alt=":(" title=":(" />" /></a>
<a href="javascript:emoticon('<img src="modules/Smileys/themes/msn/msn_laugh.gif" alt=":D" title=":D" />')" title="<img src="modules/Smileys/themes/msn/msn_laugh.gif" alt=":D" title=":D" />"><img src="modules/Smileys/themes/msn/msn_laugh.gif" alt="<img src="modules/Smileys/themes/msn/msn_laugh.gif" alt=":D" title=":D" />" title="<img src="modules/Smileys/themes/msn/msn_laugh.gif" alt=":D" title=":D" />" /></a>
<a href="javascript:emoticon('<img src="modules/Smileys/themes/msn/msn_wink.gif" alt=";)" title=";)" />')" title="<img src="modules/Smileys/themes/msn/msn_wink.gif" alt=";)" title=";)" />"><img src="modules/Smileys/themes/msn/msn_wink.gif" alt="<img src="modules/Smileys/themes/msn/msn_wink.gif" alt=";)" title=";)" />" title="<img src="modules/Smileys/themes/msn/msn_wink.gif" alt=";)" title=";)" />" /></a>
</span>
Do you know what might be causing this??

Thanks again
DG
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Implementing Smileys

Post by tobik »

Do you have the smileys modifier on this page? Because the text smileys are in the alt-attribute of the smileys tags the get replaced by the modifier.
Post Reply

Return to “Modules/Add-Ons”