Welcome Guest, Not a member yet? Register   Sign In
smileys - any luck with smiley_js?
#1

[eluser]oliur[/eluser]
Everything taken from the user guide:

Smileys can be downloaded from <a href="http://codeigniter.com/download_files/smileys.zip" target="_blank">http://codeigniter.com/download_files/smileys.zip</a>

Only bit I am not sure about is this
Code:
&lt;?php echo smiley_js('blog','comments'); ?&gt;

User manual says:
Quote:If you supplied an alias instead of an id when generating your smiley links, you need to pass the alias and corresponding form id into the function. This function is designed to be placed into the &lt;head&gt; area of your web page.

This doesn't work for me. Has anyone tried?

Here is my code

smiley_view.php
Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Smileys&lt;/title&gt;


&lt;?php echo smiley_js('blog','comments'); ?&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;form name="blog" id="blog"&gt;
&lt;textarea name="comments" id="comments" cols="40" rows="4"&gt;&lt;/textarea>
&lt;/form&gt;

<p>Click to insert a smiley!</p>

&lt;?php echo $smiley_table; ?&gt;

&lt;/body&gt;
&lt;/html&gt;


smileys.php

Code:
&lt;?php
class Smileys extends Controller {
    function Smileys()
    {
        parent::Controller();
    }
    function index()
    {
        $this->load->helper('smiley');
        $this->load->library('table');
        $image_array = get_clickable_smileys(base_url().'images/smileys/smileys', 'comments');
        $col_array = $this->table->make_columns($image_array, 8);
        $data['smiley_table'] = $this->table->generate($col_array);
        $this->load->view('smiley_view', $data);
    }
}
?&gt;
#2

[eluser]oliur[/eluser]
So far I've managed to get the smileys to appear in my text area in both IE and Firefox. For it to work with IE you need to fix something in the system/helpers/smiley_helper.php. Line 96, flip that second "text" to "smiley". So, it should read:

Code:
document.selection.createRange().text = smiley;

And, also regarding smiley_js() function you should put that in your head tag as shown below where comments refer to the name and id of the text area I have used.

Code:
&lt;?php echo smiley_js('comments','comments');?&gt;

Now, when I click on the icons they don't appear as an icon in the text area rather their corresponding name is shown. For example, if I click on smile[Smile] icon it will generate Confusedmile: and that's how it gets saved in the database as well.

I am not too fussy about that but I'd like to know how to print those back as icons. At the moment, if I display my database record it looks something like:

Quote:This is a great post. I am so happy Confusedmile: Confusedmile:

Do I need to write specific code for this?




Theme © iAndrew 2016 - Forum software by © MyBB