How to integrate tinymce in the latest version of codeigniter

I am creating a web app in codeigniter for what I need to integrate tinymce, I tried with the following code but it does not work, some may say what is wrong with the code

i created a view page named tinymce.php

    <script type="text/javascript" src="<?php echo $base_url; ?>js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// 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 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,

// 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"
});
</script>

      

also added a textbox to display tinymce

    <form method="post" action="somepage">
<textarea name="content" style="width:100%">
</textarea>
</form>

      

then tried to load the view

$this->load->view('tinymce', base_url(), true);

      

the code not only works, but it also doesn't display my textbox.

+3


source to share


3 answers


Write your javascript code in the view file itself. or just write it to a separate js file (tinymce_properties.js) and include it right after tiny_mce.js



<script type="text/javascript" src="js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="js/tiny_mce/tinymce_properties.js"></script>

<form method="post" action="somepage">
<textarea name="content" style="width:100%">
</textarea>
</form>

      

0


source


There are flaws in the code:



  • $ this-> load-> view () takes the second parameter as an array as long as you only pass the base_url value.

  • The truth in the third parameter of the $ this-> load-> view () function does not send output to the browser, so leave the field blank.

  • Make sure your paths to js outlines are correct in the snapshot list code, it seems like you put the js in the view folder inside the app.

+1


source


Make sure all plugins you download are

try this โ†’> plugins: 'advlist autolink link image lists charmap print preview',

if it works then you don't have all the plugins in your statement โ†’> plugins: "safari, spellchecker, pagebreak, style, layer, table, save, advhr, advimage, advlink, emotions, iespell, inlinepopups, insertdatetime, preview, means mass, searchreplace, print, ContextMenu, paste, directivity, full screen, non-editable, visualchars, non-breaking, xhtmlxtras, template, imagemanager, file manager ",

0


source







All Articles