如何在最新版本的codeigniter中集成时序


how to integrate tinymce in latest version of codeigniter

我正在构建一个web应用程序在codeigniter,我需要整合时间,我尝试以下代码,但它不工作,有人说什么是错误的代码

我创建了一个名为tinymce.php的视图页面

    <script type="text/javascript" src="<?php echo $base_url; ?>js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Drop lists for link/image/media/template dialogs
template_external_list_url : "js/template_list.js",
external_link_list_url : "js/link_list.js",
external_image_list_url : "js/image_list.js",
media_external_list_url : "js/media_list.js"
});
</script>

还添加了显示时间的文本框

    <form method="post" action="somepage">
<textarea name="content" style="width:100%">
</textarea>
</form>

然后尝试加载视图

$this->load->view('tinymce', base_url(), true);

的代码不仅工作,它也不显示我的文本区域

你的代码有缺陷:

  1. $this->load->view()接受第二个参数作为数组,而你只是传递base_url值

  2. $this->load->view()函数第三个参数中的true不会将输出发送给浏览器,因此将其保留为空。

  3. 确保你的路径到js的路径是正确的在下拉列表代码中,似乎你已经把js在应用程序内部的视图文件夹

在视图文件中编写javascript代码。或者直接写在单独的js文件(tinymce_properties.js)中,并将其包含在tiny_mce.js

之后。
<script type="text/javascript" src="js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="js/tiny_mce/tinymce_properties.js"></script>
<form method="post" action="somepage">
<textarea name="content" style="width:100%">
</textarea>
</form>

确保你加载的所有插件都存在

try this ->> plugins: 'advlist autolink链接图像列表charmap打印预览',

如果它工作,那么你的语句中没有所有的插件->>插件:"safari,拼写检查器,分页符,样式,层,表,保存,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,预览,媒体,搜索替换,打印,上下文菜单,粘贴,定向,全屏,不可编辑,visualchars,非中断,xhtmlxtras,模板,imagemanager,filemanager",