here is my code:
<?php
echo $this->Form->create('try');
echo $this->Form->input('title');
echo $this->Html->script('ckeditor/ckeditor');
echo $this->Form->textarea('body', array('class'=>'ckeditor'));
echo $this->Form->end('Save');
?>
On Thursday, November 10, 2011 9:36:39 AM UTC-8, andrewperk wrote:
I also had trouble using tinymce. I then tried yui's rich text editor--
and ran into a lot of styling issues and conflicts.
Finally I found ckeditor: http://ckeditor.com/. It works flawlessly
for me and is very easy to integrate, like 4 steps total.
1. Just download and put the ckeditor folder into your webroot/js/
2. Include a js link to the webroot/js/ckeditor/ckeditor.js file:
$this->Html->script("ckeditor/ckeditor");
3. Add the 'ckeditor' class to your textarea:
$this->Form->textarea('fieldname', array('class'=>'ckeditor'));
That's it, you can customize the tool bars on the editor by changing
the ckeditor/config.js file, by doing something like so for just a
very simple editor, or add more for a complex one:
CKEDITOR.editorConfig = function( config )
{
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.toolbar = 'MyToolbar';
config.toolbar_MyToolbar =
[
{ name: 'basicstyles', items :
[ 'Bold','Italic','Strike','-','RemoveFormat' ] },
{ name: 'paragraph', items :
[ 'NumberedList','BulletedList','-','Outdent','Indent','-',' Blockquote' ] },
];
};
On Nov 9, 7:30 am, ahmed fakher <spcial...@gmail.com> wrote:
> I have tried many times to use this plugin and I failed. I am
> following documentation, but it does not work for me. I am posting the
> simple code here, to know what wrong I am doing.
>
> 1-I put this plugin in this folder app/plugins
>
> 2- I add TinyMce helper to articles_controller
>
> <?php
>
> class ArticlesController extends AppController {
> // good practice to include the name variable
> var $name = 'articles';
>
> // load any helpers used in the views
> var $helpers = array('Html', 'Form','TinyMce.TinyMce');
>
> /**
> * index()
> * main index page of the formats page
> * url: /formats/index
> */
> function index(){
> // get all formats from database where status = 1
> $articles = $this->Article->find("all") ;
>
> $this->set('articles', $articles);
>
> }
>
> function admin_add() {
> // if the form data is not empty
> if (!empty($this->data)) {
> // initialise the format model
> $this->Article->save($this->data);
>
> // set a flash message
> $this->Session->setFlash('The Format has been saved');
> // redirect
> $this->redirect(array('action'=>'index'));
> } else {
> // set a flash message
> $this->Session->setFlash('The Format could not be
> saved. Please, try again.','default', array('class' => 'flash_bad'));
> }
> }
>
> }
> ?>
>
> 3- in the view file articles/admin_add.ctp I added the editor
>
> // i think the problem in this code
> <?php $this->TinyMce->editor(array(
>
> 'theme' => 'advanced'
> )); ?>
> <div class="formats form">
>
> <?php echo $form->create('Article');?>
> <fieldset>
> <legend>Add a article</legend>
> <?php
> // create the form inputs
> echo $this->Form->input('title');
> echo $this->Form->input('content'); ?>
> </fieldset>
> <?php echo $form->end('Add');?>
> </div>
>
> <ul class="actions">
> <li><?php echo $html->link('List Articles',
> array('action'=>'index'));?></li>
> </ul>
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment