I am using FCKeditor v1.6 .
If I save data without images to mysql,When load data from mysql again,It can load normally.If I insert a image into editor,It can save to mysql successful and the data in mysql is right and the data also can display normally in explorer.But when the editor load data from mysql ,It can't load data normally.I there are some errors
The step I load data from mysql as following :
******************************
<form name="form1" method="post" >
<input type="hidden" name="content" value="data from mysql"> <!-- If give mysql data to FCKeditor directly ,When the data have change line flag or many spaces,the error will be appear in javascript -->
<script language="javascript" src="/FCKeditor/fckeditor.js"></script>
<script language="javascript">
<!--
var oFCKeditor ;
oFCKeditor = new FCKeditor('content') ;
oFCKeditor.BasePath = '/FCKeditor/' ; // '/FCKeditor/' is the default value so this line could be deleted.
oFCKeditor.Value = document.form1.content.value ;
oFCKeditor.Height='330';
oFCKeditor.Config['StyleNames'] = ';Style 1;Style 2; Style 3' ;
oFCKeditor.Config['ToolbarFontNames'] = ';Arial;Courier New;Times New Roman;Verdana' ;
oFCKeditor.Create() ;
//-->
</script>
<form>
**********************************
If I save data without images to mysql,When load data from mysql again,It can load normally.If I insert a image into editor,It can save to mysql successful and the data in mysql is right and the data also can display normally in explorer.But when the editor load data from mysql ,It can't load data normally.I there are some errors
The step I load data from mysql as following :
******************************
<form name="form1" method="post" >
<input type="hidden" name="content" value="data from mysql"> <!-- If give mysql data to FCKeditor directly ,When the data have change line flag or many spaces,the error will be appear in javascript -->
<script language="javascript" src="/FCKeditor/fckeditor.js"></script>
<script language="javascript">
<!--
var oFCKeditor ;
oFCKeditor = new FCKeditor('content') ;
oFCKeditor.BasePath = '/FCKeditor/' ; // '/FCKeditor/' is the default value so this line could be deleted.
oFCKeditor.Value = document.form1.content.value ;
oFCKeditor.Height='330';
oFCKeditor.Config['StyleNames'] = ';Style 1;Style 2; Style 3' ;
oFCKeditor.Config['ToolbarFontNames'] = ';Arial;Courier New;Times New Roman;Verdana' ;
oFCKeditor.Create() ;
//-->
</script>
<form>
**********************************
RE: load data from mysql error when have image
I think instead of:
oFCKeditor.Value = document.form1.content.value ;
you may need to use something like this:
oFCKeditor.Value = $row_XXX['content'];
where "XXX" is the name of your query.
I hope this helps...
AnissaT
RE: load data from mysql error when have image
RE: load data from mysql error when have image
Hi Climby,
I'm also storing images (like <img src="/images/pic.gif">) in a mysql database. But in my case it's working well. I also using your method to set the database value from a hidden field into the fckeditor (thanks for this advice ), but I'm using a hidden textarea (<textarea style="display:none" .... >).
Have you ever tried to use an image from the internet (<img src="https://images-ssl.sourceforge.net/imag ... bg_new.gif">)? Does it works in this case?
RE: load data from mysql error when have image
there are to ways to solve the problem:
1. if you using a hidden input field (like you do so far), replace " with ' in the input field, e.g:
<input name="news" style="display:none " type="text"
value="<IMG height=100 alt=image
src='/FCKeditor/filemanager/browse/sample_html/images/natur
e.jpg' width=133 border=0>">
instead of
<input name="news" style="display:none " type="text"
value="<IMG height=100 alt=image
src="/FCKeditor/filemanager/browse/sample_html/images/natur
e.jpg" width=133 border=0>">
The problem you have is not a fck editor problem, it's a html problem.
I'm using another way:
2. I use a hidden textarea instead of a hidden input field. You don't have the problems with the " and ' characters there, e.g.:
<textarea name="news" style="display:none">
<IMG height="100" alt="image" src="/FCKeditor/filemanager/browse/sample_html/images/nature.jpg" width="133" border="0">
</textarea>
Best Regards from Ravensburg (Germany)