Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 大家帮忙看看ThinkPHP无法加载kindeditor编辑器怎么回事啊有贴代码。

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

Jun 23, 2016 pm 01:50 PM
kindeditor code load editor

最近做东西需要用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="../Public/kindeditor/themes/default/default.css" />	<link rel="stylesheet" href="../Public/kindeditor/plugins/code/prettify.css" />	<script charset="utf-8" src="../Public/kindeditor/kindeditor.js"></script>	<script charset="utf-8" src="../Public/kindeditor/lang/zh_CN.js"></script>	<script charset="utf-8" src="../Public/kindeditor/plugins/code/prettify.js"></script>	<script>                    var editor1;		KindEditor.ready(function(K) {			 editor1 = K.create('textarea[name="content"]', {				cssPath : '../Public/kindeditor/plugins/code/prettify.css',				uploadJson : '../Public/kindeditor/php/upload_json.php',				fileManagerJson : '../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>        <div>            <form method="post" name="add" action="__URL__/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>        </div>    </body></html>
Copy after login

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



谢谢大家~~~~~~~~~~~~~~~~


回复讨论(解决方案)

ThinkPHP 内置的是Smarty模板引擎,你试着把模板里的那段js代码,写到js文件里,然后引用进来

按照你说的试了一下,还是不行,直接打开可以,模板调用就不能显示kindeditor了

ThinkPHP 内置的是Smarty模板引擎,你试着把模板里的那段js代码,写到js文件里,然后引用进来

你现在会了吗,快教教我吧。

嗯,会了,主要是ThinkPHP的路径太麻烦,会出错误,建议你在配置文件中先把路径定义出来,
然后再引入编译器

<?phpreturn array(        'DB_TYPE'=>'mysql',	'DB_HOST'=>'localhost',	'DB_NAME'=>'xinxi',	'DB_USER'=>'root',	'DB_PWD'=>'root',	'DB_PORT'=>'3306',	'DB_PREFIX'=>'x_',	'DB_CHARSET'=>'utf8',        'DEBUG_MODE'=>true,       'URL_MODEL'=>1,       'DEFAULT_TEMPLATE'=>'default',       'TMPL_PARSE_STRING'=>array(        'CSS'=>'/xinxi/Xinxi/Tpl/Public/Css',        'IMAGES'=>'/xinxi/Xinxi/Tpl/Public/Images',        'JS'=>'/xinxi/Xinxi/Tpl/Public/Js',        'IMA'=>'/xinxi/upload/images',           'KIND'=>'/xinxi/Xinxi/Tpl/Public/KindEditor'		    ),);?>
Copy after login

你现在会了吗,快教教我吧。

楼主现在会了吗?

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What to do if the blue screen code 0x0000001 occurs What to do if the blue screen code 0x0000001 occurs Feb 23, 2024 am 08:09 AM

What to do with blue screen code 0x0000001? The blue screen error is a warning mechanism when there is a problem with the computer system or hardware. Code 0x0000001 usually indicates a hardware or driver failure. When users suddenly encounter a blue screen error while using their computer, they may feel panicked and at a loss. Fortunately, most blue screen errors can be troubleshooted and dealt with with a few simple steps. This article will introduce readers to some methods to solve the blue screen error code 0x0000001. First, when encountering a blue screen error, we can try to restart

Error loading plugin in Illustrator [Fixed] Error loading plugin in Illustrator [Fixed] Feb 19, 2024 pm 12:00 PM

When launching Adobe Illustrator, does a message about an error loading the plug-in pop up? Some Illustrator users have encountered this error when opening the application. The message is followed by a list of problematic plugins. This error message indicates that there is a problem with the installed plug-in, but it may also be caused by other reasons such as a damaged Visual C++ DLL file or a damaged preference file. If you encounter this error, we will guide you in this article to fix the problem, so continue reading below. Error loading plug-in in Illustrator If you receive an "Error loading plug-in" error message when trying to launch Adobe Illustrator, you can use the following: As an administrator

Essential software for C language programming: five good helpers recommended for beginners Essential software for C language programming: five good helpers recommended for beginners Feb 20, 2024 pm 08:18 PM

C language is a basic and important programming language. For beginners, it is very important to choose appropriate programming software. There are many different C programming software options on the market, but for beginners, it can be a bit confusing to choose which one is right for you. This article will recommend five C language programming software to beginners to help them get started quickly and improve their programming skills. Dev-C++Dev-C++ is a free and open source integrated development environment (IDE), especially suitable for beginners. It is simple and easy to use, integrating editor,

The computer frequently blue screens and the code is different every time The computer frequently blue screens and the code is different every time Jan 06, 2024 pm 10:53 PM

The win10 system is a very excellent high-intelligence system. Its powerful intelligence can bring the best user experience to users. Under normal circumstances, users’ win10 system computers will not have any problems! However, it is inevitable that various faults will occur in excellent computers. Recently, friends have been reporting that their win10 systems have encountered frequent blue screens! Today, the editor will bring you solutions to different codes that cause frequent blue screens in Windows 10 computers. Let’s take a look. Solutions to frequent computer blue screens with different codes each time: causes of various fault codes and solution suggestions 1. Cause of 0×000000116 fault: It should be that the graphics card driver is incompatible. Solution: It is recommended to replace the original manufacturer's driver. 2,

Resolve code 0xc000007b error Resolve code 0xc000007b error Feb 18, 2024 pm 07:34 PM

Termination Code 0xc000007b While using your computer, you sometimes encounter various problems and error codes. Among them, the termination code is the most disturbing, especially the termination code 0xc000007b. This code indicates that an application cannot start properly, causing inconvenience to the user. First, let’s understand the meaning of termination code 0xc000007b. This code is a Windows operating system error code that usually occurs when a 32-bit application tries to run on a 64-bit operating system. It means it should

Stremio subtitles not working; error loading subtitles Stremio subtitles not working; error loading subtitles Feb 24, 2024 am 09:50 AM

Subtitles not working on Stremio on your Windows PC? Some Stremio users reported that subtitles were not displayed in the videos. Many users reported encountering an error message that said "Error loading subtitles." Here is the full error message that appears with this error: An error occurred while loading subtitles Failed to load subtitles: This could be a problem with the plugin you are using or your network. As the error message says, it could be your internet connection that is causing the error. So please check your network connection and make sure your internet is working properly. Apart from this, there could be other reasons behind this error, including conflicting subtitles add-on, unsupported subtitles for specific video content, and outdated Stremio app. like

GE universal remote codes program on any device GE universal remote codes program on any device Mar 02, 2024 pm 01:58 PM

If you need to program any device remotely, this article will help you. We will share the top GE universal remote codes for programming any device. What is a GE remote control? GEUniversalRemote is a remote control that can be used to control multiple devices such as smart TVs, LG, Vizio, Sony, Blu-ray, DVD, DVR, Roku, AppleTV, streaming media players and more. GEUniversal remote controls come in various models with different features and functions. GEUniversalRemote can control up to four devices. Top Universal Remote Codes to Program on Any Device GE remotes come with a set of codes that allow them to work with different devices. you may

What does the blue screen code 0x000000d1 represent? What does the blue screen code 0x000000d1 represent? Feb 18, 2024 pm 01:35 PM

What does the 0x000000d1 blue screen code mean? In recent years, with the popularization of computers and the rapid development of the Internet, the stability and security issues of the operating system have become increasingly prominent. A common problem is blue screen errors, code 0x000000d1 is one of them. A blue screen error, or "Blue Screen of Death," is a condition that occurs when a computer experiences a severe system failure. When the system cannot recover from the error, the Windows operating system displays a blue screen with the error code on the screen. These error codes

See all articles