Skip to content

bmilesp/cakephp-wysiwyg-helper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 

Repository files navigation

Wysiwyg Helpers Plugin

I’ve been on a small refactoring spree as part of my work on Marcy Avenue. I realize, after years of working with Joomla and Wordpress, that people prefer different WYSIWYG editors. So to alleviate this, I am attempting to build a set of CakePHP helpers for each of the major WYSIWYG editors on the market, and as many small ones as possible.

The plugin also allows you to automatically change from one WYSIWYG Editor to another when using the WysiwygHelper and configuring it in the controller. You may also change the Editor within the view.

Installation

  • Clone from github : in your plugin directory type `git clone git://github.com/josegonzalez/cakephp-wysiwyg-helper.git wysiwyg`
  • Add as a git submodule : in your plugin directory type `git submodule add git://github.com/josegonzalez/cakephp-wysiwyg-helper.git wysiwyg`
  • Download an archive from github and extract it in `/plugins/wysiwyg`
  • Also download the JS distribution of your editor of choice and install it in your js folder

Available Helpers

  • Wysiwyg (Wysiwyg.Wysiwyg)
  • FCKEditor (Wysiwyg.Fck)
  • Nicedit (Wysiwyg.Nicedit)
  • Markitup (Wysiwyg.Markitup)
  • TinyMCE (Wysiwyg.Tinymce)

Usage

WyswigHelper

  1. Add the following to the controller where you’d like to use your preferred editor:
    1. var $helper = array(‘Wysiwyg.Wysiwyg’ => array(‘editor’ => ‘fck’));
      1. You can omit the parameters if you like, the default editor is ‘Tinymce’
  2. Replace your textarea inputs with either of the following:
    1. $wysiwyg→input(“ModelName.fieldName”);
    2. $wysiwyg→textarea(“ModelName.fieldName”);
  3. Array Options for the FormHelper are contained in the second parameter, while the third parameter contains and array of options for the editor
  4. Change the editor within the view as follows:
    1. $wysiwyg→changeEditor(‘nicedit’);
    2. Changes come into affect for the proceeding editor
  5. At this point, everything should theoretically work.

Other Helpers

  1. If hardcoding your editor, you can do the following:
    1. var $helper = array(‘Wysiwyg.Nicedit’);
    2. $nicedit→input(“ModelName.fieldName”);
    3. $nicedit→textarea(“ModelName.fieldName”);

TODO:

  1. Better code commenting
  2. Figure out how to include the JS distributions
  3. Enable file-uploading using whatever is native to the editor
  4. Refactor where possible
  5. Create a WysiwygHelper that will auto-create the type of helper you want based upon settings given to the view

About

cakephp helper plugin for various wysiwyg editors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%