CodeIgniter Forums
tinyMca with CI - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: tinyMca with CI (/thread-22358.html)

tinyMca with CI - El Forum - 09-06-2009

Hi everybody! (Hi, dr Nick).

I am about (for the first time) to implement the tinyMCE application (javascript) to a CI-project...and I realy dont know how to do.

Is the easiest way to do this by making av new model with a echo statement saying "include this, include that"

class Tinymce{
function Tinymce(){


echo 'my different .js-files';

and after this, just call my tinymca-class every time I need to use it?

tinyMca with CI - El Forum - 09-06-2009

did you mean timyMCE?
It works very easily with CI

tinyMca with CI - El Forum - 09-06-2009

i mean tinyMce (sorry for my misspelling). ( )

shall i proceed as my plan or in some other way?

tinyMca with CI - El Forum - 09-06-2009

Add the tiny mce code in your controller and header view as below and then drop the tinymce folder into your js folder in the root of your site.


Also note the xss_clean feature of this forum removed the script tags.


$extrahead = '[removed]script type="text/javascript" src="js/tiny_mce/tiny_mce.js[removed]
    // General options
    mode : "textareas",
    theme : "advanced",
    plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",

    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect",
    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,forecolor,backcolor",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : false,

    // Example content CSS (should be your site CSS)
    content_css : "styles.css",

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "js/template_list.js",
    external_link_list_url : "js/link_list.js",
    external_image_list_url : "js/image_list.js",
    media_external_list_url : "js/media_list.js"

            $data['extrahead'] = $extrahead;
            $data['header'] = $this->load->view('header',$data);


<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $title; ?></title>
<base href="<?php echo base_url(); ?>">

<?php if(isset($extrahead)) {
echo $extrahead;


tinyMca with CI - El Forum - 09-06-2009

er.... you nearly *always* avoid any form of echo, sprintf, etc from a Model.

A more MVC method would be to do something along the lines of (in your controller)

class cont exte.......... er{
function .......(){
  if($I_need_to_show_tinymce === true){
     $data['showTinyMCE'] = true;

and then in your view file have:
<?php if($data['showTinyMCE'] === true) ?>
[removed]......... js stuff in here....[removed]
<?php endif ?>

Like I said, prescribed MVC methodologies put down using models to affect views, but only to give and take data for the controllers.