Advertisement
Guest User

Ckeditor controller

a guest
Aug 5th, 2012
12,784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.13 KB | None | 0 0
  1. <?php
  2.  
  3. class Ckeditor extends CI_Controller {
  4.  
  5.     // extends CI_Controller for CI 2.x users
  6.  
  7.     public $data    =   array();
  8.  
  9.     public function __construct() {
  10.  
  11.         //parent::Controller();
  12.          parent::__construct(); for CI 2.x users
  13.  
  14.         $this->load->helper('ckeditor');
  15.  
  16.  
  17.         //Ckeditor's configuration
  18.         $this->data['ckeditor'] = array(
  19.  
  20.             //ID of the textarea that will be replaced
  21.             'id'    =>  'content',
  22.             'path'  =>  'js/ckeditor',
  23.  
  24.             //Optionnal values
  25.             'config' => array(
  26.                 'toolbar'   =>  "Full",     //Using the Full toolbar
  27.                 'width'     =>  "550px",    //Setting a custom width
  28.                 'height'    =>  '100px',    //Setting a custom height
  29.  
  30.             ),
  31.  
  32.             //Replacing styles from the "Styles tool"
  33.             'styles' => array(
  34.  
  35.                 //Creating a new style named "style 1"
  36.                 'style 1' => array (
  37.                     'name'      =>  'Blue Title',
  38.                     'element'   =>  'h2',
  39.                     'styles' => array(
  40.                         'color'     =>  'Blue',
  41.                         'font-weight'   =>  'bold'
  42.                     )
  43.                 ),
  44.  
  45.                 //Creating a new style named "style 2"
  46.                 'style 2' => array (
  47.                     'name'  =>  'Red Title',
  48.                     'element'   =>  'h2',
  49.                     'styles' => array(
  50.                         'color'         =>  'Red',
  51.                         'font-weight'       =>  'bold',
  52.                         'text-decoration'   =>  'underline'
  53.                     )
  54.                 )              
  55.             )
  56.         );
  57.  
  58.         $this->data['ckeditor_2'] = array(
  59.  
  60.             //ID of the textarea that will be replaced
  61.             'id'    =>  'content_2',
  62.             'path'  =>  'js/ckeditor',
  63.  
  64.             //Optionnal values
  65.             'config' => array(
  66.                 'width'     =>  "550px",    //Setting a custom width
  67.                 'height'    =>  '100px',    //Setting a custom height
  68.                 'toolbar'   =>  array(  //Setting a custom toolbar
  69.                     array('Bold', 'Italic'),
  70.                     array('Underline', 'Strike', 'FontSize'),
  71.                     array('Smiley'),
  72.                     '/'
  73.                 )
  74.             ),
  75.  
  76.             //Replacing styles from the "Styles tool"
  77.             'styles' => array(
  78.  
  79.                 //Creating a new style named "style 1"
  80.                 'style 3' => array (
  81.                     'name'      =>  'Green Title',
  82.                     'element'   =>  'h3',
  83.                     'styles' => array(
  84.                         'color'     =>  'Green',
  85.                         'font-weight'   =>  'bold'
  86.                     )
  87.                 )
  88.  
  89.             )
  90.         );     
  91.  
  92.  
  93.     }
  94.  
  95.     public function index() {
  96.  
  97.         $this->load->view('ckeditor', $this->data);
  98.  
  99.     }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement