Sunday, April 24, 2011

help with ckeditor and html

Hello I am new to cakephp and trying to install ckeditor. all seems to work
fine except any html special chars are converted to html entities. On the
first add all is well and the database seems like it holds just the html
tags but when editing html entities are added causing the tags to be viewed
in the editor.
ex: the <p> tag is saved as <p> &lt;p&gt;

I am using the cksource helper
http://bakery.cakephp.org/articles/wernerhp/2010/08/31/cksource-helper-for-ckeditor
.

Tried both ckeditor 3.1 and 3.5.3

my edit.ctp

<div class="templates form">
<?php echo $this->Cksource->create('Template');?>
<fieldset>
<legend><?php __('Edit Template'); ?></legend>
echo $this->Cksource->input('id');
echo $this->Cksource->input('title');
echo $this->Cksource->ckeditor('body');
echo $this->Cksource->input('school_id');
?>
</fieldset>
<?php echo $this->Cksource->end(__('Submit', true));?>
</div>


my controller's edit function.

function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid template', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Template->save($this->data)) {
$this->Session->setFlash(__('The template has been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The template could not be saved. Please,
try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Template->read(null, $id);
}
$schools = $this->Template->School->find('list');
$this->set(compact('schools'));
}

Thanks all

--
View this message in context: http://cakephp.1045679.n5.nabble.com/help-with-ckeditor-and-html-tp4337569p4337569.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: