How to add TinyMCe to CakePHP admin forms?
I want to add power to my CakePHP website by adding the TinyMCe editor to the forms in the Admin.
I found the plugin available at http://cakedc.com/eng/downloads/view/tinymce and follow开发者_C百科ed the steps available in that website but the form doesn't show!
Regards
You don't really need to use a plugin for this, just get the TinyMCE code and set it up in your template something like this (chopped a bit for clarity):
<?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>
?>
I actually do this as an element so that I can just drop it in where required. Study the TinyMCE wiki and api - they're incredibly useful.
精彩评论