如何将TinyMCe添加到CakePHP管理表单?

时间:2010-07-14 18:51:06

标签: cakephp web tinymce

我希望通过在管理员的表单中添加TinyMCe编辑器来增加我的CakePHP网站的功能。

我在http://cakedc.com/eng/downloads/view/tinymce找到了该插件,并按照该网站提供的步骤进行操作,但该表单未显示!

此致

1 个答案:

答案 0 :(得分:0)

你真的不需要为此使用插件,只需获取TinyMCE代码并在模板中将其设置为这样(为了清晰起见,将其切碎):

<?php
echo "\n".$javascript->link('tiny_mce/tiny_mce.js',false);
?>
<script type="text/javascript">


    $().ready(function() {
        $('textarea').tinymce({
            // Location of TinyMCE script
            //          // General options
            theme : "advanced",
            plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,...",

            // Theme options
            theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,fontselect,fontsizeselect,|,image,link,unlink,... :
"cut,copy,paste,pastetext,pasteword,|,search,replace,|,... ",
                theme_advanced_buttons3 : "tablecontrols",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                theme_advanced_statusbar_location : "bottom",
                theme_advanced_resizing : true
             });
        });
    </script>
?>

我实际上是将它作为一个元素,这样我就可以将它放在需要的地方。研究TinyMCE wiki和api - 它们非常有用。