The editor is working for me quite well, so thx for that But i have still one problem, when i I want to edit a page, created by the editor.
Imagine the following situation: Once i've created (formated) the text, it is sored in a database. Then - for example - i see a spelling mistake and want to change it. Therefore i have an own page where i can edit the page itself. (simple Update in MySQL) The Problem is now, that i do not get the stored data of the database into the editor.
I've tried the following but it did not work.
<tr> <td class=\"rowB\" width=\"100%\">
<script type=\"text/javascript\">
var sBasePath =\"http://www.*****.com/abc/FCKeditor/\";
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Height = 300 ;
oFCKeditor.Value = '$text' ;
oFCKeditor.ToolbarSet = 'mine' ;
oFCKeditor.Create() ;
</script>
</td>
</tr>
where oFCKeditor.Value = '$text'; should be the data of the database. So this doesn't work. Has anyone an idea how i can solve thi problem?
thx in advance to everyone
Mon, 07/24/2006 - 01:43
#1
RE: Insert Text from Database
oFCKeditor.Value = "some texte" works very fine for me. Please check the value of "$text" in a separate line like <?php echo $text ?> or something...
Y.Chaouche
RE: Insert Text from Database
Could it be because i integrated the editor via JavaScript and not via php ? So that the Script doesn't know what it shall do with the php variable?
RE: Insert Text from Database
Y.Chaouche
RE: Insert Text from Database
i don't know exactly what you mean but here is the code of the page where i want to edit the text:
$result = mysql_query("SELECT * FROM editor WHERE editor_id = '$editor_id'");
$row = mysql_fetch_array($result);
$text=$row["text"];
--> to get the data out of the database
print "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"1\" class=\"tablehead\">
<tr>
<td class=\"rowA\" width=\"100%\"><strong>Text</strong></td>
</tr>
<tr>
<td class=\"rowB\" width=\"100%\">
<script type=\"text/javascript\">
var sBasePath = \"http://www.***.com/abc/FCKeditor/\";
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Height = 300 ;
oFCKeditor.Value = '$text' ;
oFCKeditor.ToolbarSet = 'mine' ;
oFCKeditor.Create() ;
</script>
</td>
</tr> </table>\n";
--> the Integration of the editor via JS in the php-file
is that what you wanted or do you need the whole JS code of the editor? cause there i havent changed anything.
RE: Insert Text from Database
HI the_goose !
...
Well, actually i meant something like going to your browser and pointing to the editing page then doing something like "view source" and pasting the html code that is generated via your php script. Especially, we need to look at the javascript code generated via this php script. I hope i was clear now
Y.Chaouche
RE: Insert Text from Database
Here it is:
But now it comes: This page works! Cause it is only one line of text (This is a test) if the text consits of mor lines, paragraphes it will not work. I also tried to edit this page and write some additional lines and review it again. it only shows me tha first line. BUT it saves everything in the database. STRANGE!
RE: Insert Text from Database
I don't get it. Maybe it's about quotes ? did you try double quotes or something :
?
oFCKEditor.Value = 'text on
multiple
lines'
Changing it to :
oFCKEditor.Value="text on
multiple
lines"
I'm not sure it will change something. but who knows
Y.Chaouche