JFactory/getEditor
From Joomla! Documentation
< JFactory(Difference between revisions)
m (→Example) |
m (→Example) |
||
| Line 30: | Line 30: | ||
<b>ATTENTION:</b> | <b>ATTENTION:</b> | ||
| − | Be aware that JRequest by default filters all HTML-code. To store HTML-code with your model class you <b>MUST | + | Be aware that JRequest::GET by default filters all HTML-code. To store HTML-code with your model class you <b>MUST</b> explicitely allow HTML in JReqest::GET, otherwise all HTML will be stripped |
<source lang="php"> | <source lang="php"> | ||
Revision as of 14:09, 12 August 2009
Returns a reference to the global editor object, only creating it if it doesn't already exist. The object returned will be of type JEditor.
Syntax
object JEditor getEditor( $editor )
where:
| Argument | Data type | Description | Default |
|---|---|---|---|
| $editor | string | The name of the editor (for example, 'tinymce'). If null then the current editor will be returned. | null |
Example
In this example, you can see how to display the editor and send specific display parameters.
$editor =& JFactory::getEditor(); $params = array( 'smilies'=> '0' , 'style' => '1' , 'layer' => '0' , 'table' => '0' , 'clear_entities'=>'0' ); echo $editor->display( 'desc', '', '400', '400', '20', '20', false, $params );
For a complete list of parameters that can be passed to the TinyMCE editor, see the Joomla source file: /plugins/editor/tinymce.php.
ATTENTION: Be aware that JRequest::GET by default filters all HTML-code. To store HTML-code with your model class you MUST explicitely allow HTML in JReqest::GET, otherwise all HTML will be stripped
/*The store-procedure in your model might then look like this*/ [...] function store() { $row =& $this->getTable(); $data = JRequest::get( 'post'); /* Get proper data for your HTML-encoded field now */ $data['description']=JRequest::getVar( 'description', '', 'post', 'string', JREQUEST_ALLOWHTML ); $row->bind($data); [...] $row->check(); [...] $row->store(); [...] } [...]