PHPackages                             josegonzalez/cakephp-wysiwyg - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. josegonzalez/cakephp-wysiwyg

AbandonedArchivedCakephp-plugin[Utility &amp; Helpers](/categories/utility)

josegonzalez/cakephp-wysiwyg
============================

cakephp helper plugin for various wysiwyg editors

2.0.1(12y ago)6432.9k22MITPHP

Since Jul 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/josegonzalez/cakephp-wysiwyg)[ Packagist](https://packagist.org/packages/josegonzalez/cakephp-wysiwyg)[ Docs](http://github.com/josegonzalez/cakephp-wysiwyg)[ RSS](/packages/josegonzalez-cakephp-wysiwyg/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (3)Used By (0)

[![Build Status](https://camo.githubusercontent.com/acee1a23556b0170630cafbf59c55ae0686e352e3362f693655b5c98b4ca76f8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a6f7365676f6e7a616c657a2f63616b657068702d777973697779672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/josegonzalez/cakephp-wysiwyg)[![Coverage Status](https://camo.githubusercontent.com/73bef5c0302ad1bd07d2b753a7c9cf607ad319e47d8b6b3fd650491ebca81c9b/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6a6f7365676f6e7a616c657a2f63616b657068702d777973697779672e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/josegonzalez/cakephp-wysiwyg?branch=master)[![Total Downloads](https://camo.githubusercontent.com/77228e80ef8ad1ed2597ecdb2d72bea30d10e996633e423985e7fbfec9e1fe62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f7365676f6e7a616c657a2f63616b657068702d777973697779672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/josegonzalez/cakephp-wysiwyg)[![Latest Stable Version](https://camo.githubusercontent.com/ad22a5b900fe325eb911c394d44749de4f85e75695d7be4f3cb163ed11e1b2dc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f7365676f6e7a616c657a2f63616b657068702d777973697779672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/josegonzalez/cakephp-wysiwyg)[![Documentation Status](https://camo.githubusercontent.com/8122ad8918cd2fc55405cc8a0a3d8d2c06eaa1288862ef174d537c5f3b6b74b8/68747470733a2f2f72656164746865646f63732e6f72672f70726f6a656374732f63616b657068702d777973697779672f62616467652f3f76657273696f6e3d6c6174657374267374796c653d666c61742d737175617265)](https://readthedocs.org/projects/cakephp-wysiwyg/?badge=latest)[![Gratipay](https://camo.githubusercontent.com/40a48c7b3fc02e9d39dd715fe09e404c4cb2e89288c6ace0773d2aab6913b46f/68747470733a2f2f696d672e736869656c64732e696f2f67726174697061792f6a6f7365676f6e7a616c657a2e7376673f7374796c653d666c61742d737175617265)](https://gratipay.com/~josegonzalez/)

Wysiwyg Helpers Plugin 2.0
==========================

[](#wysiwyg-helpers-plugin-20)

Include Wysiwyg Editors quickly and easily

Background
----------

[](#background)

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.

Requirements
------------

[](#requirements)

- CakePHP 2.x

Installation
------------

[](#installation)

Download the JS distribution of your editor of choice and install it in your js folder.

*\[Using [Composer](http://getcomposer.org/)\]*

Add the plugin to your project's `composer.json` - something like this:

```
{
	"require": {
		"josegonzalez/cakephp-wysiwyg": "dev-master"
	}
}

```

Because this plugin has the type `cakephp-plugin` set in it's own `composer.json`, composer knows to install it inside your `/Plugins` directory, rather than in the usual vendors file. It is recommended that you add `/Plugins/Upload` to your .gitignore file. (Why? [read this](http://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).)

*\[Manual\]*

- Download this:
- Unzip that download.
- Copy the resulting folder to `app/Plugin`
- Rename the folder you just copied to `Wysiwyg`

*\[GIT Submodule\]*

In your app directory type:

```
git submodule add git://github.com/josegonzalez/cakephp-wysiwyg-helper.git Plugin/Wysiwyg
git submodule init
git submodule update

```

*\[GIT Clone\]*

In your plugin directory type

```
git clone git://github.com/josegonzalez/cakephp-wysiwyg-helper.git Wysiwyg

```

### Enable plugin

[](#enable-plugin)

In 2.0 you need to enable the plugin your `app/Config/bootstrap.php` file:

```
CakePlugin::load('Wysiwyg');

```

If you are already using `CakePlugin::loadAll();`, then this is not necessary.

Usage
-----

[](#usage)

### Available Helpers

[](#available-helpers)

> The default editor is Tinymce

To use any of these helpers, you should create a folder in the `web/js` folder which is named the lowercase version of your editor of choice. This folder should contain the entire distribution of files necessary for your editor to be in use. For example, the `NiceditHelper` requires the `web/js/nicedit/nicEdit.js` and `web/js/nicedit/nicEditorIcons.gif` files.

To configure where these files exist, please see the helper code.

- CKEditor (Wysiwyg.Ck)
- Jwysiwyg (Wysiwyg.Jwysiwyg)
- Markitup (Wysiwyg.Markitup)
- Nicedit (Wysiwyg.Nicedit)
- TinyMCE (Wysiwyg.Tinymce)

### Using the Generic WyswigHelper

[](#using-the-generic-wyswighelper)

Add the following to the controller where you'd like to use your preferred editor. You can omit the parameters if you like, the default editor is `tinymce`:

```
public $helpers = array('Wysiwyg.Wysiwyg' => array('editor' => 'Ck'));

```

Replace your textarea inputs with either of the following:

```
echo $this->Wysiwyg->input('ModelName.fieldName', $inputOptions, $helperOptions);
echo $this->Wysiwyg->textarea('ModelName.fieldName', $inputOptions, $helperOptions);

```

Array Options for the FormHelper are contained in the second parameter, while the third parameter contains and array of options for the editor

You can also change the editor within the view. Changes come into affect for the proceeding editor:

```
$this->Wysiwyg->changeEditor('Nicedit', $helperOptions);

```

At this point, everything should theoretically work.

### Other Helpers

[](#other-helpers)

If hardcoding your editor, you can do the following in your Controller:

```
