我在我的一个网站上使用TinyMCE,因为我决定使用这个编辑器,所以我想要删除整个网站。
当我登录时,一切都像魅力一样(除了TinyMCE有时会过着自己的生活),但是当我想要更新/替换图像时,它根本不会做任何事情。在TinyMCE预览编辑器中,一切看起来都很棒,但是当我将它保存到数据库时没有任何反应。
有谁知道这可能是什么?
提前谢谢
修改:
以下是TinyMCE在编辑时使用的代码:
<?php
if($isadmin) {?>
<form method="post" action="dump.php?id=2">
<!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">
<?php } ?>
<?php echo $row[1]; ?>
<?php
if($isadmin) {?>
</textarea>
<br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
<?php } ?>
这是TinyMCE用来运行的代码:
<?php
session_start();
ob_flush ();
require_once ("include/config.php");
if(isset($_SESSION['admin_user']) && isset($_SESSION['admin_password'])){
$isadmin = true;
}else{
$isadmin = false;
}
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die("Failed to connect");
mysql_select_db($dbname) or die("cant access");
// id=4 är sidan 4
$result = mysql_query("SELECT * FROM content WHERE id=2") or die("couldn't select data");
$row = mysql_fetch_row($result);
?>
<?php
if($isadmin) {?>
<!-- TinyMCE -->
<script type="text/javascript" src="admin/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "autolink,lists,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",
// 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,
// Skin options
skin : "o2k7",
skin_variant : "silver",
// Example content CSS (should be your site CSS)
content_css : "css/example.css",
// 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",
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
</script>
<?php
}
?>
答案 0 :(得分:0)
我有类似的问题。发生了什么事,Tiny将图像路径转换为相对路径。我所做的是在Tiny配置的一般选项中禁用此选项:
relative_urls: false,
remove_script_host: false,
convert_urls: false
答案 1 :(得分:0)
您是否尝试在文档准备好后启动tinyMCE?
$(function() {
tinyMCE.init({
...
});
});