title: CKEditor -> CodeIgniter
body: <p>I am trying to configure CKEditor but I get the following in my source, it seems that the helper is not being sent any of the $data from my <strong>index function</strong>,  My helper is located <code>application/helpers</code> </p>
  
  <p>This is my code:</p>
  
  <p><strong>Helper:</strong></p>
  
  <pre><code>&lt;?php
  if(!defined('BASEPATH')) exit('No direct script access allowed');
  
  /*
   * CKEditor helper for CodeIgniter
   * 
   * @author Samuel Sanchez &lt;samuel.sanchez.work@gmail.com&gt; - http://kromack.com/
   * @package CodeIgniter
   * @license http://creativecommons.org/licenses/by-nc-sa/3.0/us/
   * @tutorial http://kromack.com/developpement-php/codeigniter/ckeditor-helper-for-codeigniter/
   * @see http://codeigniter.com/forums/viewthread/127374/
   * @version 2010-08-28
   * 
   */
  
  /**
   * This function adds once the CKEditor's config vars
   * @author Samuel Sanchez 
   * @access private
   * @param array $data (default: array())
   * @return string
   */
  function cke_initialize($data = array()) {
  
      $return = '';
  
      if(!defined('CI_CKEDITOR_HELPER_LOADED')) {
  
          define('CI_CKEDITOR_HELPER_LOADED', TRUE);
          $return =  '&lt;script type="text/javascript" src="'.base_url(). $data['path'] . '/ckeditor.js"&gt;&lt;/script&gt;';
          $return .=  "&lt;script type=\"text/javascript\"&gt;CKEDITOR_BASEPATH = '" . base_url() . $data['path'] . "/';&lt;/script&gt;";
      } 
  
      return $return;
  
  }
  
  /**
   * This function create JavaScript instances of CKEditor
   * @author Samuel Sanchez 
   * @access private
   * @param array $data (default: array())
   * @return string
   */
  function cke_create_instance($data = array()) {
  
      $return = "&lt;script type=\"text/javascript\"&gt;
          CKEDITOR.replace('" . $data['id'] . "', {";
  
              //Adding config values
              if(isset($data['config'])) {
                  foreach($data['config'] as $k=&gt;$v) {
  
                      // Support for extra config parameters
                      if (is_array($v)) {
                          $return .= $k . " : [";
                          $return .= config_data($v);
                          $return .= "]";
  
                      }
                      else {
                          $return .= $k . " : '" . $v . "'";
                      }
  
                      if($k !== end(array_keys($data['config']))) {
                          $return .= ",";
                      }                       
                  } 
              }               
  
      $return .= '});&lt;/script&gt;';  
  
      return $return;
  
  }
  
  /**
   * This function displays an instance of CKEditor inside a view
   * @author Samuel Sanchez 
   * @access public
   * @param array $data (default: array())
   * @return string
   */
  function display_ckeditor($data = array())
  {
      // Initialization
      $return = cke_initialize($data);
  
      // Creating a Ckeditor instance
      $return .= cke_create_instance($data);
  
  
      // Adding styles values
      if(isset($data['styles'])) {
  
          $return .= "&lt;script type=\"text/javascript\"&gt;CKEDITOR.addStylesSet( 'my_styles_" . $data['id'] . "', [";
  
  
          foreach($data['styles'] as $k=&gt;$v) {
  
              $return .= "{ name : '" . $k . "', element : '" . $v['element'] . "', styles : { ";
  
              if(isset($v['styles'])) {
                  foreach($v['styles'] as $k2=&gt;$v2) {
  
                      $return .= "'" . $k2 . "' : '" . $v2 . "'";
  
                      if($k2 !== end(array_keys($v['styles']))) {
                           $return .= ",";
                      }
                  } 
              } 
  
              $return .= '} }';
  
              if($k !== end(array_keys($data['styles']))) {
                  $return .= ',';
              }           
  
  
          } 
  
          $return .= ']);';
  
          $return .= "CKEDITOR.instances['" . $data['id'] . "'].config.stylesCombo_stylesSet = 'my_styles_" . $data['id'] . "';
          &lt;/script&gt;";     
      }   
  
      return $return;
  }
  
  /**
   * config_data function.
   * This function look for extra config data
   *
   * @author ronan
   * @link http://kromack.com/developpement-php/codeigniter/ckeditor-helper-for-codeigniter/comment-page-5/#comment-545
   * @access public
   * @param array $data. (default: array())
   * @return String
   */
  function config_data($data = array())
  {
      $return = '';
      foreach ($data as $key)
      {
          if (is_array($key)) {
              $return .= "[";
              foreach ($key as $string) {
                  $return .= "'" . $string . "'";
                  if ($string != end(array_values($key))) $return .= ",";
              }
              $return .= "]";
          }
          else {
              $return .= "'".$key."'";
          }
          if ($key != end(array_values($data))) $return .= ",";
  
      }
      return $return;
  }
  **.htaccess:**
  # Customized error messages.
  ErrorDocument 404 /index.php
  
  # Set the default handler.
  DirectoryIndex index.php
  
  # Various rewrite rules.
  &lt;IfModule mod_rewrite.c&gt;
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|css|js|images|files|scripts|robots\.txt)
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
  &lt;/IfModule&gt; 
  </code></pre>
  
  <p><strong>Source</strong></p>
  
  <pre><code>&lt;script type="text/javascript" src="http://house.dev.local//ckeditor.js"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;CKEDITOR_BASEPATH = 'http://house.dev.local//';&lt;/script&gt;&lt;script type="text/javascript"&gt;
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>   if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  class Editpage extends CI_Controller {
  
      function __construct(){
      parent::__construct();
      }
  
    function index($id){
  
          if(!$this-&gt;session-&gt;userdata('logged_in'))redirect('admin/home');
  
          $this-&gt;load-&gt;helper('ckeditor');
          //Ckeditor's configuration
          $this-&gt;data['ckeditor'] = array(
  
              //ID of the textarea that will be replaced
              'id'    =&gt;  'content',
              'path'  =&gt; 'includes/js/ckedit',
  
              //Optionnal values
              'config' =&gt; array(
                  'toolbar'   =&gt;  "Full",     //Using the Full toolbar
                  'width'     =&gt;  "550px",    //Setting a custom width
                  'height'    =&gt;  '100px',    //Setting a custom height
  
              ),
  
              //Replacing styles from the "Styles tool"
              'styles' =&gt; array(
  
                  //Creating a new style named "style 1"
                  'style 1' =&gt; array (
                      'name'      =&gt;  'Blue Title',
                      'element'   =&gt;  'h2',
                      'styles' =&gt; array(
                          'color'     =&gt;  'Blue',
                          'font-weight'   =&gt;  'bold'
                      )
                  ),
  
                  //Creating a new style named "style 2"
                  'style 2' =&gt; array (
                      'name'  =&gt;  'Red Title',
                      'element'   =&gt;  'h2',
                      'styles' =&gt; array(
                          'color'         =&gt;  'Red',
                          'font-weight'       =&gt;  'bold',
                          'text-decoration'   =&gt;  'underline'
                      )
                  )               
              )
          );
          if ($this-&gt;input-&gt;post('submit')){
  
              #The User has submitted updates, lets begin!
  
              #Set The validation Rules   
              $this-&gt;form_validation-&gt;set_rules('content', 'Content', 'trim|required|xss_clean');
  
              #if the form_validation rules fail then load the login page with the errors. Otherwise continue validating the user/pass
              if ($this-&gt;form_validation-&gt;run() == FALSE){
  
                  $data['cms_pages'] = $this-&gt;navigation_model-&gt;getCMSPages($id);
                  #connect to getCMSCotent and set the page info equal to the $data['page'] where the row is equal to the passed $id from the URL.
                  $data['page'] = $this-&gt;page_model-&gt;getCMSContent($id);
  
                  $data['content'] = $this-&gt;load-&gt;view('admin/editpage', $data, TRUE);
                  $this-&gt;load-&gt;view('admintemplate', $data);
  
              }               
              #Form Validation passed, so lets continue updating.
                  #lets set some variables.
                  $content = $this-&gt;input-&gt;post('content', TRUE);
  
                  #Now if updatePage fails to update hte database then show "there was a problem", you could echo the db error itself
                  if($this-&gt;page_model-&gt;updatePage($id, $content)) {
                      $data['cms_pages'] = $this-&gt;navigation_model-&gt;getCMSPages($id);
                      #connect to getCMSContent and set the page info equal to the $data['page'] where the row is equal to the passed $id from the URL.
                      $data['page'] = $this-&gt;page_model-&gt;getCMSContent($id);
                      $data['success'] = TRUE;
                      $data['content'] = $this-&gt;load-&gt;view('admin/editpage', $data, TRUE);
                      $this-&gt;load-&gt;view('admintemplate', $data);
                  }//END if updatePage
              }else{
              $data['cms_pages'] = $this-&gt;navigation_model-&gt;getCMSPages($id);
  
              #connect to getCMSCotent and set the page info equal to the $data['page'] where the row is equal to the passed $id from the URL.
              $data['page'] = $this-&gt;page_model-&gt;getCMSContent($id);
  
              $data['content'] = $this-&gt;load-&gt;view('admin/editpage', $data, TRUE);
              $this-&gt;load-&gt;view('admintemplate', $data);
          }//END if post submitted
      } //END function index()
  
  }
  </code></pre>