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, 08: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, 05:01 AM
q2ip q2ip is offline
Moderator
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, 05: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: 7
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, 05:16 AM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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, 05: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: 7
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, 05: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: 7
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, 08: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, 08: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, 06: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: 7
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, 06:14 AM
partyganger partyganger is offline
Junior Member
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, 09: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: 7
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, 06: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, 07: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: 7
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, 12:18 PM
snooze snooze is offline
Junior Member
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, 07: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, 06:30 AM
flashbuggy flashbuggy is offline
Junior Member
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, 06: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, 04:26 PM
yakesha yakesha is offline
Junior Member
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, 07:26 AM
3Stars 3Stars is offline
Junior Member
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