It is not as "simple" as you think. After more than 4 hours of hacking to try to make everything I have read work in PHP it still does not work.
I admit I am a novice when it comes to javascript, but it baffles me that I can't find a "simple" example for inputting dynamic text using PHP in FCKeditor on the internet anywhere.
I am able to replicate the example8.html but that doesn't help me because the text I am trying to insert is dynamic in the form. It would be really useful if you could point me to a place where I can get an example that works.
The key is that you can't do that in PHP, it must be done in javascript. So use sample8 as a base and set the javascript string from the php code, and then use javascript to insert that string.
I'm trying to do the same thing, basically I have pre-formatted sets of text that i want to add to the text editor by clicking on a link, I have tried this, but as expected it did not work
this gives an error, oEditor is not defined , I'm also using fckeditor with PHP , it would be really nice to get some help with this , because it is vital for a function i'm working on...
function InsertHTML()
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
// Check the active editing mode.
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
{
// Insert the desired HTML.
oEditor.InsertHtml( '- This is some <a href="/Test1.html">sample<\/a> HTML -' ) ;
}
else
alert( 'You must be on WYSIWYG mode!' ) ;
}
Re: Insert text at cursor position?
Re: Insert text at cursor position?
Re: Insert text at cursor position?
I admit I am a novice when it comes to javascript, but it baffles me that I can't find a "simple" example for inputting dynamic text using PHP in FCKeditor on the internet anywhere.
I am able to replicate the example8.html but that doesn't help me because the text I am trying to insert is dynamic in the form. It would be really useful if you could point me to a place where I can get an example that works.
Thanks!
Re: Insert text at cursor position?
Re: Insert text at cursor position?
$buff.= "<a href=\"javascript:oEditor.InsertHtml('hello');\">hello</a>this gives an error, oEditor is not defined , I'm also using fckeditor with PHP , it would be really nice to get some help with this , because it is vital for a function i'm working on...thanks for the help.
Re: Insert text at cursor position?
function InsertHTML() { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Check the active editing mode. if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) { // Insert the desired HTML. oEditor.InsertHtml( '- This is some <a href="/Test1.html">sample<\/a> HTML -' ) ; } else alert( 'You must be on WYSIWYG mode!' ) ; }Re: Insert text at cursor position?