最近做东西需要用ThinkPHP调用kindeditor,我直接打开Tpl文件夹中的html文件编辑器正常显示,可是当我输入网址
localhost/app/index.php/editor时,html页面也能显示,但是textarea无法显示成kindeditor页面!!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加</title>
<link rel="stylesheet" href="/cms/tpl/Index/Public/kindeditor/themes/default/default.css?3.8.99" />
<link rel="stylesheet" href="/cms/tpl/Index/Public/kindeditor/plugins/code/prettify.css?3.8.99" />
<script charset="utf-8" src="/cms/tpl/Index/Public/kindeditor/kindeditor.js?3.8.99"></script>
<script charset="utf-8" src="/cms/tpl/Index/Public/kindeditor/lang/zh_CN.js?3.8.99"></script>
<script charset="utf-8" src="/cms/tpl/Index/Public/kindeditor/plugins/code/prettify.js?3.8.99"></script>
<script>
var editor1;
KindEditor.ready(function(K) {
editor1 = K.create('textarea[name="content"]', {
cssPath : '/cms/tpl/Index/Public/kindeditor/plugins/code/prettify.css',
uploadJson : '/cms/tpl/Index/Public/kindeditor/php/upload_json.php',
fileManagerJson : '/cms/tpl/Index/Public/kindeditor/php/file_manager_json.php',
allowFileManager : true,
afterCreate : function() {
var self = this;
K.ctrl(document, 13, function() {
self.sync();
K('form[name=content]')[0].submit();
});
K.ctrl(self.edit.doc, 13, function() {
self.sync();
K('form[name=content]')[0].submit();
});
}
});
prettyPrint();
});
</script>
</head>
<body>
<p>
<form method="post" name="add" action="/index.php/Article/add">
标题:<input type="text" name="title" /><br />
类型:<select name="type">
<option value="1">--类型1--</option>
<option value="2">--类型2--</option>
</select><br />
内容: <textarea name="content" style="width:700px;height:200px;" >在这里添加内容</textarea><br /><br />
<input type="submit" name="button" value="提交内容" />
<input type="reset" name="reset" value="重 置">
</form>
</p>
</body>
</html>
文件夹的相对路径没有问题,因为直接打开html文件可以显示kindeditor编辑器,只是模板调用时不能显示。
谢谢大家~~~~~~~~~~~~~~~~
------解决方案--------------------
ThinkPHP 内置的是Smarty模板引擎,你试着把模板里的那段js代码,写到js文件里,然后引用进来
友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群