nikos101 12-22-2007, 01:12 PM I can't find anything wrong with this code <!-- Initialise the editor --><script>
initRTE('<table align=\"\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
<tbody>
<tr></tr></tbody></table>', 'example.css');
</script>
However this throws an error in firebug and the page doesn't display it correctly, i get an error in firebug
unterminated string literal
initRTE('<table align=\"\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" widt...
Does anyone have and idea whats going on?
You don't need to escape "s inside a '-delimited string
nikos101 12-22-2007, 01:22 PM thanks but i changed it to
<!-- Initialise the editor -->22<script>
23initRTE('<table>
24<tr></tr></table>', 'example.css');
25</script>
and I still get the error. however if i remove the <tr></tr> i get no error
Philip M 12-22-2007, 02:03 PM I agree with gjay's comment, but:-
Have you tried escaping the /s?
<tr><\/tr><\/tbody><\/table>', 'example.css');
and keeping it all on one line?
Arty Effem 12-22-2007, 02:32 PM this throws an error in firebug and the page doesn't display it correctly, i get an error in firebug
unterminated string literal
initRTE('<table align=\"\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" widt...
Does anyone have and idea whats going on?
To break a single string over multiple lines, each segment must end with a '\'
'<table align=\"\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"\ width=\"100%\">\
<tbody>\
<tr></tr></tbody></table>'
nikos101 12-22-2007, 04:28 PM The real trouble stems from the fact that I'm using a Rich text editor
FreeRichTextEditor.com
to generate the tables. It works fine when it is retrived from the database into the content page but when I try and display the html used in the editor for editing is when I get the problems
Philip M 12-22-2007, 04:44 PM In that case the solution is obvious!
nikos101 12-22-2007, 04:46 PM I agree, email the original coder
nikos101 12-22-2007, 04:58 PM thanks but i changed it to
<!-- Initialise the editor -->22<script>
initRTE('<table>
<tr></tr></table>', 'example.css');
</script>
and I still get the error. however if i remove the <tr></tr> i get no error
the argument does
nikos101 12-22-2007, 05:15 PM ok so how would I automate the adding of \ to the argument to initRTE. eg how would I
write code to convert
<table align="" border="4" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td></tr>
<tr>
<td> </td>
<td> </td>
<td> </td></tr>
<tr>
<td> </td>
<td> </td>
<td> </td></tr></tbody></table>
into
<table align="" border="4" cellpadding="0" cellspacing="0" width="100%">\
<tbody>\
<tr>\
<td> </td>\
<td> </td>\
<td> </td></tr>\
<tr>\
<td> </td>\
<td> </td>\
<td> </td></tr>\
<tr>\
<td> </td>\
<td> </td>\
<td> </td></tr></tbody></table>
Philip M 12-22-2007, 05:39 PM Use a text editor using find and replace.
nikos101 12-22-2007, 05:44 PM yes but I want it done dynamically with Javascript so that the user doesn't need to do find and replace
Philip M 12-22-2007, 07:35 PM Arrh, to be sure, you can't be doing it as the Javascript has to be a valid string before you manipulate it to turn it into a valid string .....:D
"If I were you, I wouldn't start from here" as the Irishman said when asked the way to Dingle. :D
nikos101 12-22-2007, 07:47 PM Man that kind of stinks a bit.
How on earth am I going to pass the content data to the rich text editor for editing. Maybe I could do it with php?
Trinithis 12-22-2007, 09:00 PM You need to put the sting all on one line.
nikos101 12-22-2007, 09:18 PM I see, cool, so how in php do I remove all the white space at the ends of the lines?
:)
feeling better now, I've worked so hard on this and this problem looks to be coming to an end:)
mayureshb 05-05-2008, 01:50 PM hi,
i faced smiler problem while using freerichtexteditor was getting error
"unterminated string..."
while inserting the values from the rte to DB , i replaced \r\n with blank and the problem was resolved for me.
for PHP: str_replace("\r\n","",$_REQUEST['RTE_content'])
Regards
Mayuresh Bhomkar
|