PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 7th, 2002, 09:11 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
PHP and WUSIWUG editor

Im glad that the forums back in action and that i can finally ask this question.

You probally remember the WYSIWYG editor by mytch.

Well what i was wondering, using PHP how would i upload the html from this editor to a database(mysql) or atleast convert it into a variable so that i can process it???

i think someone posted about this before, but it was lost in the transfer

Thanks in advance

Reply With Quote
  #2  
Old April 8th, 2002, 06:01 AM
q2ip q2ip is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: South Africa
Posts: 7 q2ip User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to q2ip
hi ben,
well it's in the content of an iframe, so just use something like

var src = new string();
src = document.iFrame.document.body.innerHTML;

then set a hidden form field in the parent document to the value of src:

<input type="hidden" name='hiddenSrc" value="">

document.hiddenSrc.value = src;

then submit the form...does that sound ok to you?

Reply With Quote
  #3  
Old April 8th, 2002, 06:08 AM
wAr-AnGeL wAr-AnGeL is offline
Forum Security
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Behind You
Posts: 479 wAr-AnGeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 50 sec
Reputation Power: 16
Send a message via ICQ to wAr-AnGeL Send a message via AIM to wAr-AnGeL
does that mean the variable "src" would contain all the info within the iframe? then you can use $src inside the php code?

i r stupid

Reply With Quote
  #4  
Old April 8th, 2002, 06:16 AM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 588 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
nah,
when you submit the html form, you can then get the hiddenSrc form field variable as $hiddenSrc through PHP on the page where the form was submitted. from there you can add it to the database or do whatever else you like with it.

Reply With Quote
  #5  
Old April 8th, 2002, 06:21 AM
wAr-AnGeL wAr-AnGeL is offline
Forum Security
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Behind You
Posts: 479 wAr-AnGeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 50 sec
Reputation Power: 16
Send a message via ICQ to wAr-AnGeL Send a message via AIM to wAr-AnGeL
Ahh, ok. Now i get it

Reply With Quote
  #6  
Old April 8th, 2002, 06:28 AM
wAr-AnGeL wAr-AnGeL is offline
Forum Security
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Behind You
Posts: 479 wAr-AnGeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 50 sec
Reputation Power: 16
Send a message via ICQ to wAr-AnGeL Send a message via AIM to wAr-AnGeL
Question

one more question:

how would i make a drop-down box with a few classes from my CSS. like .title, .blah, .bleh and then apply it to the selected text?


Reply With Quote
  #7  
Old April 8th, 2002, 09:14 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Ok im abit stuck, i changed the script to look like this

<form action="print_script.php" method="post">
<script language="JavaScript">
function getCode()
{
var src = iView.document.body.innerHTML;
document.test.value = src;
alert(src);
}
</script>
<input type="hidden" name="test">
<input type="button" onClick="getCode();" value="update">
<input type="submit" name="submit" value="upload to DB">
</form>


Now if you look at this, it look right??? wrong! click the update button, it doesnt work

take out the line

document.test.value = src;

now the alert works

anyone have any idea??????

Thanks

Reply With Quote
  #8  
Old April 8th, 2002, 09:29 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Thanks to my good friend Mytch, the problem is now solved(and i need to read my Javascript book again!)

replace the above problem line with

document.all.test.value =src;

Thats it, now you can send that to your asp or php page and upload it to your db, or what ever you want, in this case, im using it for a project im working on

May The Force Be With You

Linux Forever!

Reply With Quote
  #9  
Old April 12th, 2002, 07:10 AM
wAr-AnGeL wAr-AnGeL is offline
Forum Security
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Behind You
Posts: 479 wAr-AnGeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 50 sec
Reputation Power: 16
Send a message via ICQ to wAr-AnGeL Send a message via AIM to wAr-AnGeL
if i had my content in a variable called $content, how would I print it into the iframe for editing?
__________________




"Only Linux users see the end of crashes."
- Pl4t0

Reply With Quote
  #10  
Old April 12th, 2002, 07:14 AM
partyganger partyganger is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Limmen
Posts: 16 partyganger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
sometimes it helps to give the form a name / id as well, and then do a document.formname.controlname.value. This usually does the job for me.

Reply With Quote
  #11  
Old April 12th, 2002, 10:20 AM
wAr-AnGeL wAr-AnGeL is offline
Forum Security
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Behind You
Posts: 479 wAr-AnGeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 50 sec
Reputation Power: 16
Send a message via ICQ to wAr-AnGeL Send a message via AIM to wAr-AnGeL
Thumbs up Wahoo!

Yay, I got it to work ! I would like to thank Ben for helping me debug my code and mytch for writing the great tutorial.


Reply With Quote
  #12  
Old April 12th, 2002, 07:51 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
No Problems, its good to see that your learning, and after those few hickups i hope you wont have the same problems again

Reply With Quote
  #13  
Old April 12th, 2002, 08:13 PM
wAr-AnGeL wAr-AnGeL is offline
Forum Security
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Behind You
Posts: 479 wAr-AnGeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 50 sec
Reputation Power: 16
Send a message via ICQ to wAr-AnGeL Send a message via AIM to wAr-AnGeL
Hehe, thanks for reminding me on a few newbie mistakes I made. I did. "UPDATE table(field1, field2, field3); VALUES ($form1, $form2, $form3) WHERE id=$id" instead of the proper syntax "UPDATE articles SET field1= '$form1', field2='$form2', field3='$form3' WHERE id=$id";

My bad

Reply With Quote
  #14  
Old April 18th, 2002, 01:18 PM
snooze snooze is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 1 snooze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi everybody!
i am a total newbie in java script and it would be very nice if someone could post the hole code or at least the one to insert my php variable $html to the iframe.

Reply With Quote
  #15  
Old April 25th, 2002, 08:52 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
ok if you have say

if you send the info from another page, one way to load it in the editor is like this.

<iframe src="load.php?html=info">

create a page called load.php

in it add this line

<?php

echo $html

?>

i hope thats what your trying to do

Reply With Quote
  #16  
Old May 8th, 2002, 07:30 AM
flashbuggy flashbuggy is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 1 flashbuggy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

I have a problem with special characters like '
when ever I use these in a sentence like hey c'mon , the text gets converted to hey c/'mon, how can I fix this in PHP?

Reply With Quote
  #17  
Old May 8th, 2002, 07:51 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
There is a way,

try using this function

stripslashes ($var);

convert the data from the editor into a php var and parse it though that function, that should convert \' to ' and \\ to \

hope that helps

Reply With Quote
  #18  
Old May 26th, 2002, 05:26 PM
yakesha yakesha is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: UK
Posts: 6 yakesha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to yakesha
Insert Image

Hi to everyone

Well this happens to be my first post but i have been hanging around this place since quite some time.

I am stuck on inserting images in my WYSIWYG html editor.

After reading the article by Mitch and the documentation of "execCommand" at MSDN, i find myself struggling with some queries. I would appreciate if anyone could answer them.

Well the first one being that i am not able to download the support files for the 2nd article where its explained on how to connect to the database. The file i am downloading succesfully as the size of 0bytes.

Then i am struggling with the image insertion part. Both Mitch's article and the documentation at Microsoft explicitly says, if "InsertImage" is called with the middle parameter of "execCommand" set to true, it presents a modal dialog box to select an image. But i am not able to make it work. Mitch is using an alert box, to enable user the enter the location of image manually. What i need is to allow the guy to browse and select the image, may be just on the server and forget abt uploading at the moment.
Actually i am trying to develop a HTML editor which will alow clients to upload their own images as well as select from the online server which could be a differnet domain and i am kinda stuck on that.

If anyone could propose any solutions, i'd really appreciate that.


Yakesh

Reply With Quote
  #19  
Old May 28th, 2002, 08:26 AM
3Stars 3Stars is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Netherlands
Posts: 3 3Stars User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to 3Stars
Question same thing

yeah, i'm also trying to make my own editor more complete. Mitch Thanks for the great article!
But now i'm stuck at the same point, inserting the images.

My goal is to be able to insert images from the harddisk.
I can insert them into my iframe, so far so good. But i need to find a way of uploading those images and them inserting in the iframe.... i'm good enough in PHP to do the uploading... but not from the modal dialog box... how do i do this??

anyone help me!!

thanks,

Tije

Reply With Quote
  #20  
Old May 28th, 2002, 09:39 AM
yakesha yakesha is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: UK
Posts: 6 yakesha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to yakesha
Insert images

Well uploading is not a problem, once you allow the "person" to select a file from the hard drive, you just upload the file and change the src of the file in the document.

BUT, i bet most people would find hard to locate the file on the drive if they were to type it manually.

Well the another problem is to allow the person to browse the images already on the server and use them. According to me, one would need to use a File manager for the server directories, but i dont know of any good one which i could use and then dont have much ideas on how to put all this together.

I guess there are not many people around, no ones seem to be replying. Or may be the question isnt good enough?

Cheeers.

Reply With Quote
  #21  
Old May 28th, 2002, 01:47 PM
3Stars 3Stars is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Netherlands
Posts: 3 3Stars User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to 3Stars
how? en how!

how would you do the upload them??
you say it simple.. it should be i guess but i dunno how to do it excactly....

browsing files from the harddisk can be done simple without promting for the path... just use a form field with the TYPE="FILE" en u wil get a [Browse...] button

navigating through directories can be done simple using phps dir handling... http://www.php.net/manual/en/ref.dir.php

hope that helped u... hope u can help me further...

Reply With Quote
  #22  
Old May 28th, 2002, 06:42 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
of course your question is good enought, please dont forget the members of devarticles also have day jobs, (most of us) so it does take some time to reply. now that we got that outa the way heres what you need to do.

instead of using the execCommand, open up a popup window, you will need to make a image manager! you can either upload to a directory or a database, the database is probally more easier. you'll need to have two pages, one for uploading the images, and one for viewing thumbnails,

the upload page should be fairly simple, the thumbnail page is a bit harder, you need to be able to do a few things.

delete the image, view the image full size, and insert the image, you should be able to insert the image using the execCommand,

i hope that gives you some ideas what to do, if you get stuck, post your question here, and ill try to help, also look at the demo of URL post an article, and upload a image into that article, that should give you some help

Ben Rowe

Reply With Quote
  #23  
Old May 31st, 2002, 12:05 PM
yakesha yakesha is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: UK
Posts: 6 yakesha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to yakesha
Image editorrrrrrr

Now thats one thing i never created before. Lets see.

Thanks for the suggestion. I am onto it now.

3Stars, abt the file uploading, well there are number of scripts that are available on the web. If you cant find one, drop in a mail to me and i will give you one.

Now how would you upload the images which user selects from the hard drive. Simpple.

On the exit (Save) function of your editor, pass all the local image paths to your FILE UPLOAD function one by one, upload them to a specified directory and change the IMAGE SRC in the document to the new path.

Wouldnt be hard once you make ur file upload function work. What all is required is that you make it automatic, rather than prompting the user which files to upload. hmm From another angle, keep all the image files in an array(thier path) and upload them all at once when the user sumbits the page.

hmm hope that helped.

Cheeers.

Reply With Quote
  #24  
Old June 3rd, 2002, 05:50 PM
3Stars 3Stars is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Netherlands
Posts: 3 3Stars User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to 3Stars
hmm the next step...

hi all,

thanks for all your help so far... got me pretty far i think.

i'm no working on 2 solutions...

[1] direct selection through a FILE-field... direct upload, changing local path 2 online path and the inserting the image.

[2] setting all locals to an javascriptarray. when save is pushed, all files in array should be uploaded and then all paths should be changed....


the first method is the simple one to make in my view... some php work but its less userfriendly i think. thats the reason im still working on the second one....but now im stuck again...
can anyone help me with the uploading from the javascriptarray??
how should i do this... does anyone have some code for me here??

Reply With Quote
  #25  
Old June 6th, 2002, 02:18 PM
kots kots is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: between 0 and infinity
Posts: 2 kots User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question How to add <br> tags in iframe

Many thanks to Mitch for an excellent article

Saved many research hours…

Everything is working fine but I am missing one functionality – being able to add “<br>” tags. Could anyone tell me if it is possible with javascript – like a button that will imbed the tag in the text, or some other way I can enter verbose text.

Thanks

Kots

Reply With Quote
  #26  
Old June 6th, 2002, 03:17 PM
kots kots is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: between 0 and infinity
Posts: 2 kots User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb

How silly… I just found out that shift-enter = <br> in most MS based editors

Reply With Quote
  #27  
Old June 9th, 2002, 04:45 PM
water water is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 10 water User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
does anyone know if it's possible to set up the link window so the user can specify a link target without going into the html source?

:water

Reply With Quote
  #28  
Old September 7th, 2004, 12:45 PM
nem nem is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 1 nem User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I am in a simular situation now, I have created a wysiwyg editor based on an iframe, i can submit the html code but i can not retrieve the content so that it shows in the wyiwyg i created for editing.

Can anyone help me? I am extracting from a dbase using php.

Reply With Quote
  #29  
Old March 10th, 2005, 02:30 PM
Think28 Think28 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 2 Think28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 7 sec
Reputation Power: 0
Where can I find all the necessary files for this WYSIWYG editor? The files from the tutorial seems to be a broken link.

Is there something similar to this and compatible with FireFox?

Thanks.

Reply With Quote
  #30  
Old March 10th, 2005, 02:31 PM
Think28 Think28 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 2 Think28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 7 sec
Reputation Power: 0
http://www.devarticles.com/c/a/HTML/Building-a-WYSIWYG-HTML-Editor-Part-1/3/

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP and WUSIWUG editor


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap