Re: CKEditor and model validation

2013-04-16 Thread angel reyes
Thanks it works.

On Sunday, April 14, 2013 12:54:42 PM UTC-7, frederikjacques wrote:

 Hi Chris,

 I've written a blog post about this issue with sample code.
 You can read it here 
 http://blog.the-nerd.be/2013/04/add-ckeditor-to-cakephp-with-model-validation/

 Cheers,
 Frederik

 On Saturday, April 13, 2013 8:35:42 PM UTC+2, Chris wrote:

 hi frederik,... 
 I have a problem submitting with ckeditor,... this is my form,... but its 
 not passing content to controller,... 

 ?php echo $this-Html-script('ckeditor/ckeditor'); ?

 p style=display: block; font-size: 1.2em; text-align: left;
 ?php  echo $this-Form-textarea('content', array('rows' = '3', 'cols' 
 = '5', 'class' = 'ckeditor')); ?
 /p

 can you share with us please,... 
 thanks in advance 
 chris

 On Saturday, April 13, 2013 9:11:15 AM UTC-7, frederikjacques wrote:

 Hi all,

 I was wondering how you can use CKEditor and the model validation array.
 I got my textareas changed to CKEditors, but now my validation fails. 
 If I remove a rule like non-empty everything works again, but I would 
 rather keep my validation rules :-)

 Cheers,
 Frederik



-- 
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+unsubscr...@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.




Re: How to use tinymce plugin?

2013-04-12 Thread angel reyes
I tried your steps, it shows the editor but when i tried to submit the form 
it fails.
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 
  legendAdd 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+unsubscr...@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.