Codeigniter Create a Chat Emoji using Smiley Helper - Mostlikers

31 March, 2017

Codeigniter Create a Chat Emoji using Smiley Helper

Today we are going to see How to create chat emoji in CodeIgniter. In this tutorial, I have used the smiley helper to display the emoji images. Codeigniter default has this smiley library. For images, you need download and load from the images folder. In case you are using chatbox and comments section. Implement this future.

Overview of Smiley helper

The Smiley helper has a renderer that takes plain text smileys, like :-) and turns them into an image representation.This all the emoji plain text have set of array function config/smileys.php files. if you want to create more emojis use that array function just add your own smileys code with the alias name.


There some Clickable Smileys Script also there in libraries. The moment you click the emoji reactions. Script has been taking the plain text to display the comment box section.

Folder : application/config/smileys.php

Download smiley images

Before you begin, download smiley images and put the downloaded images in your publicly accessible folder.

Example : projectfolder/resources/images/smiley/


Create a controller class name called 'Welcome' with index function.
class Welcome extends CI_Controller {

    public function __construct()
        $this->load->helper(array('form', 'url'));

    public function index()
        $image_array = get_clickable_smileys(base_url().'resources/images/smileys/', 'comments');
        $col_array = $this->table->make_columns($image_array, 8);
        $data['smiley_table'] = $this->table->generate($col_array);

  • $this->load->lirary('table') - Here I have used clickable smileys to demo process. table load all the images.
  • get_clickable_smileys() - Get all the smileys plain text from the library.


Create a new file application/views/smile.php. Put the below HTML code.
      <?php echo smiley_js(); ?>
      <div class="container">
            <h2>Codeigniter Create a Chat Emoji using Smiley Helper</h2>
            <form name="blog">
               <h3>Your comments</h3>
               <textarea name="comments" id="comments" cols="40" rows="4"></textarea>
            <h4>Click to insert a smiley!</h4>
            <?php echo $smiley_table; ?>

  • smile_js() - load the script for clickable smileys images plain text to the comment box.
  • $smile_table - Display all the smileys images.


$str = "This tutorial make me :wow: ";
 $str = parse_smileys($str, base_url().'resources/images/smileys/');
 echo $str;

  • parse_smileys - Convert all the emojis plain text to images.
  • base_url('images') - Current server smileys image path location.

The Smiley helper is DEPRECATED and should not be used. The trying to revamp the helper. Will soon update the latest version helper.

Try your self >>


  1. The Demo isn't working for now can you check that please