Using TinyMCE, iBrowser With CakePHP

TinyMCE
  • Setup
    • Download TinyMCE in Here
    • After downloaded, extract to TinyMCE folder and copy /tiny_mce folder into /webroot/js in cakePHP.
  • Config
    • Putting this code to layout (or view if you don't want to use default for all layout)
       <?php
      if(isset($javascript)):
       echo $javascript->link('tiny_mce/tiny_mce.js');
      endif;
      ?>
      
    • Define to use javascript helper in Controller:
      <script type="text/javascript">
      tinyMCE.init({
      theme : "advanced",
      mode : "textareas",
      convert_urls : false
      });
      </script>
      
* mode : "textareas" : All of textareas will be change to tinyMCE editor.
iBrowser
  • Setup
  • Config
    • Config config.inc.php in config folder line 96:
      $cfg['ilibs'] = array ( array ( 'value' => '/bitcms/app/webroot/img/uploads/, 'text'   => 'Site Pictures', ),
      
* 'value' => '/bitcms/app/webroot/img/uploads/: path of image folder.
    • Copy tinyMCE.editor_plugin.js from interface folder in ibrowser folder to ibrowser folder and rename it to editor_plugin.js
    • Define ibrowser plugin and include ibrowser button :
      <script type="text/javascript">
      tinyMCE.init({
      plugins : "ibrowser", theme : "advanced",
       theme_advanced_buttons3_add : "ibrowser",
      mode : "textareas",
      convert_urls : false
      });
      </script>
    • If it's have error : ib is undefined. To fix:
       var ib = null;
      
    • Change index page to insert pageEdit file ibrowser.php, add code after line 129 (btnStage();)
      /*
      imDiv that contain adv content
      call changeClass(0,'imDiv','hideit'); to hide  adv content
      */
      changeClass(0,'imDiv','hideit');
      /*
      inDiv that contain insert form
      call changeClass(0,'inDiv','showit'); to showit
      */
      changeClass(0,'inDiv','showit');
      
Good luck!

Share this

Related Posts

First