开发者

TinyMCE is able to update texts but not images, why is this?

I'm using TinyMCE on one of my sites and I've reached a point where I want to delete the whole site because of my stupid decision to use this editor.

When I'm logged in, everything works like a charm (except for that TinyMCE lives it's own life sometimes), but when I want to update/replace an image it doesn't do anything at all. Everything looks great in the TinyMCE preview editor, but when I save it to the database nothing happens.

Does anyone know what this could be?

Thank you in advance

EDIT:

Here's the code TinyMCE is using when I'm editing:

<?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 } ?>

And here's the code that TinyMCE uses to run:

<?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开发者_C百科,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
}
?>


I had a similar problem. What happened is that Tiny converted the image path to relative paths. What I did was disable this option in general options in Tiny configuration:

relative_urls: false,
remove_script_host: false,
convert_urls: false


have you tried to init tinyMCE after the document is ready??

$(function() {
   tinyMCE.init({
   ...
   });
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜