Using Joomla default editor for the custom component

Using joomla inbuilt editor for text areas in the Form

1) In view page:

Add the below code to replace the text area with Editor

$editor = JFactory::getEditor();
echo $editor->display(‘textarea_name’, $textarea_content, ‘655’, ‘400’, ’20’, ’20’, false);

 

2) In Model page

To insert editor data with out striping tags in to the database.

// get editor content

$editor_content = JRequest::getVar( ‘textarea_name’, ”, ‘post’, ‘html’, JREQUEST_ALLOWRAW );

// insert into database

$query = “INSERT INTO  `#__table_name`  (title,content)  VALUES (‘$title’,addslashes($editor_content))”;

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *