rendered paste bodyWithin template:
{if $preferFCK == true}
{fckeditor assign="editor" name="new_text" x=600 y=600 text=$text toolbar="page"}
{$editor->create()}
{else}
<textarea name="new_text" id="new_text" rows="10" cols="40">{$text}</textarea>
{/if}
But first, plugin must be registered when smarty object is created:
require_once($smarty->_get_plugin_filepath('function', 'fckeditor'));
And the plugin itself:
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.fckeditor.php
* Type: function
* Name: fckeditor
* Purpose: Creates a fckEditor instance on demand
* -------------------------------------------------------------
*/
function smarty_function_request($params, &$smarty)
require_once(DOC_ROOT .'/lib/FCKeditor/fckeditor.php');
if (isset($params['name'])) {
$smarty->trigger_error("editor name missing", E_USER_ERROR);
return;
}
$data = new FCKeditor($params['name']);
$data->BasePath = DOC_ROOT .'/lib/FCKeditor/';
$data->Width = (isset($params['x']) ? (int) $params['x'] : 400);
$data->Height = (isset($params['y']) ? (int) $params['y'] : 400);
$data->ToolbarSet = (isset($params['toolbar']) ? (int) $params['toolbar'] : 'Default');
$data->Value = (isset($params['text']) ? $params['text'] : '');
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $data);
}
else {
return $data;
}
?>