Forum closed. New forum available at http://community.wymeditor.org/

Loading up a file inside the editor

Support forum for WYMeditor.

Loading up a file inside the editor

Postby Casperin on Sun Jan 27, 2008 1:16 am

How do I load up a file and place it in the editor? I see the
Code: Select all
html: '<p>Hello, World!<\/p>',
but I don't know how to replace that with the content of another file.

Great editor though. I absolutely love it (once I learn how to do this anyway).. :-)
Casperin
 
Posts: 1
Joined: Sun Jan 27, 2008 1:11 am

Postby issac.kelly on Sat Feb 02, 2008 3:35 pm

Are you using some server side technology to write the page or just html/js?

you could use the ajax functions of jquery to get the contents of the file and put it in a variable.

wymHTML = $get('someFile', startWYM());

function startWYM(){
$('.wymeditor').wymeditor({
html: wymHTML
});
}

But if you have some server-side, it may be prudent to get the file from there, as you reduce the number of server requests.
issac.kelly
 
Posts: 9
Joined: Sat Feb 02, 2008 2:42 pm

Postby maxwell on Thu Mar 06, 2008 11:17 pm

I have a similar problem.

I started out using WYMEditor to write to a file called wym.txt, using fwrite in php.

Now, I'm trying to find out how to load that file back into wymeditor for editing.

I tried the above code, but it didn't seem to work, maybe I'm doing something wrong?

An example file might be helpful :wink:
maxwell
 
Posts: 1
Joined: Thu Mar 06, 2008 6:59 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests