Home  >  Article  >  Backend Development  >  大家帮忙看看~ThinkPHP无法加载kindeditor编辑器咋回事啊有贴代码

大家帮忙看看~ThinkPHP无法加载kindeditor编辑器咋回事啊有贴代码

WBOY
WBOYOriginal
2016-06-13 12:05:50850browse

大家帮忙看看~~ThinkPHP无法加载kindeditor编辑器怎么回事啊????有贴代码。
最近做东西需要用ThinkPHP调用kindeditor,我直接打开Tpl文件夹中的html文件编辑器正常显示,可是当我输入网址


localhost/app/index.php/editor时,html页面也能显示,但是textarea无法显示成kindeditor页面!!

<br /><html><br />    <head><br />        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><br />        <title>添加</title>   <br />        <link rel="stylesheet" href="../Public/kindeditor/themes/default/default.css" /><br />	<link rel="stylesheet" href="../Public/kindeditor/plugins/code/prettify.css" /><br />	<script charset="utf-8" src="../Public/kindeditor/kindeditor.js"></script><br />	<script charset="utf-8" src="../Public/kindeditor/lang/zh_CN.js"></script><br />	<script charset="utf-8" src="../Public/kindeditor/plugins/code/prettify.js"></script><br />	<script><br />                    var editor1;<br />		KindEditor.ready(function(K) {<br />			 editor1 = K.create('textarea[name="content"]', {<br />				cssPath : '../Public/kindeditor/plugins/code/prettify.css',<br />				uploadJson : '../Public/kindeditor/php/upload_json.php',<br />				fileManagerJson : '../Public/kindeditor/php/file_manager_json.php',<br />				allowFileManager : true,<br />				afterCreate : function() {<br />					var self = this;<br />					K.ctrl(document, 13, function() {<br />						self.sync();<br />						K('form[name=content]')[0].submit();<br />					});<br />					K.ctrl(self.edit.doc, 13, function() {<br />						self.sync();<br />						K('form[name=content]')[0].submit();<br />					});<br />				}<br />			});<br />			prettyPrint();<br />		});<br />	</script><br />    </head><br />    <body><br />        <div><br />            <form method="post" name="add" action="__URL__/add"><br />                标题:<input type="text" name="title" /><br /><br />                类型:<select name="type"><br />                    <option value="1">--类型1--</option><br />                    <option value="2">--类型2--</option><br />                </select><br /><br />               内容: <textarea  name="content" style="width:700px;height:200px;" >在这里添加内容</textarea><br /><br /><br />               <input type="submit" name="button" value="提交内容" /><br />                <input  type="reset" name="reset" value="重    置"><br />            </form><br />        </div><br />    </body><br /></html><br />

文件夹的相对路径没有问题,因为直接打开html文件可以显示kindeditor编辑器,只是模板调用时不能显示。



谢谢大家~~~~~~~~~~~~~~~~
------解决方案--------------------
ThinkPHP 内置的是Smarty模板引擎,你试着把模板里的那段js代码,写到js文件里,然后引用进来

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn