PDA

View Full Version : [HOW TO] Add WYSIWYG Editor to Your Modifications


Mythotical
23 Nov 2009, 18:44
I do this as a free service, I am a student however and all donations are welcome. You can click on the Paypal icon to make a donation: https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif (https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=S45W6HN9D3FGU)

I will add instructions for pulling data when editing a file.


This article was done for vB 3.5 and later, I now bring you the article for vB 4.0 in regards to the editor in modifications.

Working Versions: Currently 4.1.10
Testing Versions: NONE

This tutorial will provide you the proper method for including the WYSIWYG editor in your modifications. I have tested this and it works so following this tutorial will provide a working editor. You are welcome to tweak it to your liking so that you get different output's or vice versa.

Lets begin.

Step 1. Make sure you have already added the row to your database table. The new row to add is:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

You can alter that to be messagearea, message, description, etc and it will work just the same.

Step 2. Open your template containing your form.
Step 3. Install the provided plugin xml file.
Step 3. Add the following lines of code.

Now add this in place of your opening form tag (Remember to change your action to your correct file):


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Step 4. Add the following to your php file.

Open the file you wish to add your editor to (Make sure you have this code in the area where your template containing the editor is to be called):


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Then edit your template register and add the following:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Add this line to your php file after you define special templates, global templates, etc:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Add these to your specialtemplates:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Step 5. Save and close your file, upload and test. Make sure you saved your template as well.

This is a short article/tutorial and I hope many find it useful. Even though I did not come up with the code or discover the code, I am happy to help others out as I was helped out.

Preview provided at attachments.

RS_Jelle
25 Nov 2009, 07:56
Instead of adding all these templates to globaltemplates, you could add this:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Even better, use action templates:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

zbahadir
25 Nov 2009, 09:14
Thanks. :)

Mythotical
25 Nov 2009, 16:27
Instead of adding all these templates to globaltemplates, you could add this:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Even better, use action templates:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Thanks, I'll update the article to reflect your suggestion.

I should ask what that does since I have never seen that code before. I'm sure others will question as well.

RS_Jelle
25 Nov 2009, 20:35
Thanks, I'll update the article to reflect your suggestion.

I should ask what that does since I have never seen that code before. I'm sure others will question as well.

It just caches the editor templates, in an easier way :)

From /includes/class_bootstrap.php:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



+ If you don't do it this way, this mod (http://www.vbulletin.org/forum/showthread.php?t=178327) won't work (if it gets ported to vB4).

Mythotical
25 Nov 2009, 21:28
It just caches the editor templates, in an easier way :)

From /includes/class_bootstrap.php:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



+ If you don't do it this way, this mod (http://www.vbulletin.org/forum/showthread.php?t=178327) won't work (if it gets ported to vB4).

Ah great info, thank you for clarifying, I have included it in the article as well. I plan to go change my ported mods to include that as well.

MaryTheG(r)eek
13 Dec 2009, 15:06
I've followed the instruction, editors works as it must works, but in all pages there is that dammit yellow triangle at browser's status bar with error:
vB_XHTML_Ready has not been definied
URI: http://www.microhellas.com/main/clientscript/vbulletin-editor.js?v=400b5


Maria

Mythotical
13 Dec 2009, 17:02
Maria, can you show me the page that you get the yellow triangle? I don't get the triangle so I'm a bit concerned right now, oh yeah, what browser you viewing the page in?

MaryTheG(r)eek
13 Dec 2009, 17:18
Maria, can you show me the page that you get the yellow triangle? I don't get the triangle so I'm a bit concerned right now, oh yeah, what browser you viewing the page in?

Sure. http://www.microhellas.com/main/support.php

Thank you so much. By the way. IE8

Maria

Mythotical
13 Dec 2009, 17:21
Hmmmm, I opened it in IE8 but I get no error report. Let me check a few things and I'll post back.

Your welcome.

MaryTheG(r)eek
13 Dec 2009, 17:31
Hmmmm, I opened it in IE8 but I get no error report. Let me check a few things and I'll post back.

Your welcome.

Thank you for taking the time to help me. If you want, I've post the full product at:
http://www.vbulletin.org/forum/showthread.php?t=230112
but I think that I follown your instructions step by step.

Maria

Mythotical
13 Dec 2009, 17:39
Apparently that error triangle is from subscriptions portion. Might be a bug with vB. I have tried to replicate it and even tried adding new tickets and such, still no error on my end. Sorry I couldn't provide more info than that. I'm actually sitting here scratching my head over it. LOL

MaryTheG(r)eek
13 Dec 2009, 17:42
Apparently that error triangle is from subscriptions portion. Might be a bug with vB. I have tried to replicate it and even tried adding new tickets and such, still no error on my end. Sorry I couldn't provide more info than that. I'm actually sitting here scratching my head over it. LOL

Ok:-)) Let to see if anybody report it in my post. My site is not the stablest on the net, actually it has nothing, so maybe something else causes it.

take care
Maria

Mythotical
13 Dec 2009, 17:43
Possibly, if you need help narrowing down where it may come from, I'll gladly help you out.

AndrewD
14 Dec 2009, 15:45
I've spent today tearing my hair out in updating the wysiwig editor from vb3.8 to v4.0 in a product I handle. Eventually, I tried reproducing the problem using the code suggested here, and the same problem arose. Basically, when in full WYSIWIG mode, the text entered into the message box is not being returned to the server, unless one first refreshes the page. In standard mode (obtained either by using the control switch in the editor, or by setting the appropriate vb options), everything works fine. This means that the problem cropped up with IE and Firefox but not with Google Chrome or Safari, which always use the standard editor.

For some reason, though, this problem does not seem to crop up in, e.g., the standard VB editpost code.

Possibilities are that I've made a mistake (quite possible...), or there's a bug in vb4.0 (I'm testing with RC2), or there's a switch/file that we're overlooking.

The attached files are, as far as I can tell, a straight copy of the material posted at the start of this article, within a script that simply keeps re-presenting the form along with a record of the message entered by the user the previous time round. I'd be very grateful if someone can independently test this, and let me know if I'm going crazy or not.

The two files are a php script to be loaded into the forum directory, and a template.

Mythotical
14 Dec 2009, 16:07
I noticed 2 things.

First:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



You have that but not registered it for use in the template.

Second:
In your template I notice you have the form pointing to the same file that you are using to fill out this form. Am I mistaken that maybe you didn't give the process form location.

Also I noticed that you don't have this in your file:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



With your submit button, try this instead:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

AndrewD
14 Dec 2009, 16:42
Thanks for the suggestions, see below.

I noticed 2 things.

First:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



You have that but not registered it for use in the template.

Also I noticed that you don't have this in your file:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




sorry, Steve, not true - both are done (line 7 and 45 in the php file)


Second:
In your template I notice you have the form pointing to the same file that you are using to fill out this form. Am I mistaken that maybe you didn't give the process form location.


this was intended to be a simpe demo of the problem, and the script is designed to return to itself, report what was filled in the message box, and then re-present the editor. So, there's no error with that, and the same issue presents itself in the (much more complex) product code I'm working on.


With your submit button, try this instead:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



This makes no difference. The message box contents are being correctly picked up in standard editor mode but not in wysiwig mode.

Mythotical
14 Dec 2009, 16:56
Then you have completely contradicted what you said earlier about it not working. If you can't show me how this is being used in the complexity that you are trying to make it work then I can be of no help. Lastly there apparently is an error as you stated earlier and now you state there is no error. Overall you have your code set so without more info then I am of no help any further. Sorry.

AndrewD
14 Dec 2009, 17:18
Then you have completely contradicted what you said earlier about it not working. If you can't show me how this is being used in the complexity that you are trying to make it work then I can be of no help. Lastly there apparently is an error as you stated earlier and now you state there is no error. Overall you have your code set so without more info then I am of no help any further. Sorry.

I'll try to be a little clearer, since I didn't intend to seem to contradict myself.

The supplied attached php + template is a straightforward implementation of the code given in the first post, intended to demonstrate the problem.

With this demo code, and with the more complex product implementation, the contents of the editor message box are correctly returned (with all browser choices) when the editor is set to standard mode but not when it is set to wysiwig mode. I can consistently reproduce this problem on my own system. I am asking for someone else to attempt to reproduce it on another, so that I can be sure that it is/is not a bug in my coding or in the vb infrastructure.

Mythotical
14 Dec 2009, 17:43
I'll try to be a little clearer, since I didn't intend to seem to contradict myself.

The supplied attached php + template is a straightforward implementation of the code given in the first post, intended to demonstrate the problem.

With this demo code, and with the more complex product implementation, the contents of the editor message box are correctly returned (with all browser choices) when the editor is set to standard mode but not when it is set to wysiwig mode. I can consistently reproduce this problem on my own system. I am asking for someone else to attempt to reproduce it on another, so that I can be sure that it is/is not a bug in my coding or in the vb infrastructure.

Ok gotcha, I will test it out and check for you.

--------------- Added 1260816961 at 1260816961 ---------------

Ok tested it, you had a few issues in your template but I changed them to match my site mainly and it worked.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



--------------- Added 1260816996 at 1260816996 ---------------

It all had to do with link tags and script tags.

EDIT AGAIN:
Tested again with your code and it worked that time so looks like it was in the template.

The way you have it, I have no idea why it won't work that way, not even sure what could cause it to not post.

xman_79
20 Dec 2009, 13:11
not understand why you use



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



The php file



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I use the editor to about 10 hacks, I have no problem.

Mythotical
23 Dec 2009, 07:27
The part that I use above is sticking with code ethics basically, it saves on lines of code per file and does the same exact thing as this does:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Just one line of code instead of 10-15 lines to call all those templates.

In all honesty, you don't have to call these templates as you have done:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



From what I have learned is that each one of those templates is already cached and called when you use the editor.

MaryTheG(r)eek
24 Dec 2009, 09:21
Hello Steve,

I've problem including the editor in my mod. See the attached images to understand what I mean. The first one is without including "...GET_EDIT_TEMPLATES..." in my php file, the second is with this.

http://www.microhellas.com/dev4/auctions.php?do=addedititem

I'm also getting that yellow triangle:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Thank you in advance
Maria

PS- I found the solution

At the very top of the template,

After:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



and Before:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Must be:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



But that dammit triangle still exists.

Merry Christmas Steve (and to all surfers of course).
Maria

Mythotical
24 Dec 2009, 18:16
Great to hear Maria.

MaryTheG(r)eek
26 Dec 2009, 09:49
Hello Steve,

In view mode the text loses some formatting (in my case bullets). See attachment 1 which is in edit mode. Bullet list has been saved correctly. Now the 2nd attachment. Even if the text coloring is ok, the bullet list appears as normal text lines.

The code that I've wrote:

PHP file


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Template


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Thank you
Maria

Mythotical
26 Dec 2009, 18:07
Thanks Maria, I will get it altered in the article.

mikey1991
04 Feb 2010, 19:54
Steve, I know you posted this article for vB3, or one was posted, I just cannot find it. Any help?

Mythotical
05 Feb 2010, 02:04
Steve, I know you posted this article for vB3, or one was posted, I just cannot find it. Any help?

Here is the article, not written by me: Add Editor to Your Mods (http://www.vbulletin.org/forum/showthread.php?t=135708)

mikey1991
05 Feb 2010, 15:57
Great, thanks alot steve, appreciate that.

Mythotical
15 Feb 2010, 21:20
Great, thanks alot steve, appreciate that.

Your welcome.

Jaxel
29 Mar 2010, 06:44
Anyone got any ideas on what I should put in my DATAMANAGER so that it verifies a text field?

Jaxel
30 Mar 2010, 03:22
Okay... I've followed this guide EXACTLY... but I have a few questions and problems... I've circled the obvious problems in red...

http://www.vbulletin.org/forum/attachment.php?attachmentid=115004&stc=1&d=1269919038

1 - "Fonts" dropdown menu is missing.
2 - "Sizes" dropdown menu is missing the word "Sizes".
3 - "Bullets" and "Lists" buttons are missing.
4 - "Quote" "Code" "PHP" buttons are missing.
5 - I have no need for attachments or video embedding in this, so I would like to remove those buttons.
6 - "Tooltips" (alt tags?) are missing from all buttons.
7 - The word "More" on the bottom right is missing.

In VB3, in order to put an editor into your mod, you had to do some plugin work. I assume that is gone now?

Also, when posting the textarea to my script, what is the variable name? $vbulletin->GPC['message'] perhaps?

And how do I add a DEFAULT VALUE for this textarea?

Jaxel
30 Mar 2010, 03:37
Looking at this code here in the guide is COMPLETELY outdated:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



This works for me: fixed a few of my problems, but not all.... the only still missing is the phrasegroup for Fonts, Sizes and More.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



New question, how do we use the QR? I tried adding 'qr' to the end of the construct, but it killed entry into the box.

Mythotical
30 Mar 2010, 06:01
Sorry haven't had time to update this guide to match 4.0 gold release. I will get to it once I am able.

Jaxel
01 Apr 2010, 03:28
Add the following if you want to use QR (Quick Reply)



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Unfortunately, I am having a bug, where the buttons on the quick-reply bars aren't working. They work fine on the FE (Full Editor), but not the QR.

Jaxel
06 Apr 2010, 21:32
Whenever I use the QR editor, I always get an error...



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



If I change to the FE editor, the error disappears.

Jaxel
15 Apr 2010, 14:50
Has anyone been able to get the QR editor working yet?

MaryTheG(r)eek
15 Apr 2010, 15:38
Has anyone been able to get the QR editor working yet?

I've included it in all of my mods for vb4. Where are you facing difficulties?

Maria

Jaxel
16 Apr 2010, 03:37
This is the code I am using...



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




But I keep getting the following error:
Uncaught ReferenceError: vB_Text_Editor is not defined

As well, none of the buttons on the QR work. If I change the editor to FE, it works fine without error.

Vaupell
17 Apr 2010, 15:12
Works great, Thanks microhellas.

MaryTheG(r)eek
17 Apr 2010, 16:24
Hello all,

The code to include qr editor is:

1.- PHP File


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



2.- Template


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Works fine in 3 of my mods as you can see in the attached photo. Sorry, but as this article is not mine, I can't comes throught a full tutorial.

Maria

Vaupell
17 Apr 2010, 16:37
Hello all,

The code to include qr editor is:

1.- PHP File


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



2.- Template


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Works fine in 3 of my mods as you can see in the attached photo. Sorry, but as this article is not mine, I can't comes throught a full tutorial.

Maria


thank you so much, this was excaktly what i needed

I can get this working just fine, but the full editor wont work for me
message returns blank..

But this is fine,, Tx Maria ;) :up:

MaryTheG(r)eek
17 Apr 2010, 17:10
but the full editor wont work for me
message returns blank..

Just use this:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Please note that the last part is to show an editor according to usergroup permissions (eg full WYSIWYG). The first part, is the field name. You can use '' to let it empty.

Maria

Jaxel
17 Apr 2010, 17:27
I dont know man... I copy and pasted your code EXACTLY and I'm still getting the same error.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



The text editor "works", it will accept input and what not, but the buttons on it (such as bold/italics) don't.

MaryTheG(r)eek
17 Apr 2010, 17:33
I dont know man... I copy and pasted your code EXACTLY and I'm still getting the same error.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



The text editor "works", it will accept input and what not, but the buttons on it (such as bold/italics) don't.

You can ignore that error, as it's vB bug, and appears only to IE8. As for the buttons, be sure to include in the <head> section:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



--------------- Added 1271525701 at 1271525701 ---------------

I dont know man...

By the way... I'm WOMAN.

Maria

Jaxel
17 Apr 2010, 17:42
Heh, sorry, woman... Anyways, I got all that and it's not making a difference, text editor buttons dont work... the error pops up on the console in Chrome too... This is all my code related to this...



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Everything works fine if I switch to the FE, instead of the QR... but I don't want to use the FE in this specific spot.

MaryTheG(r)eek
17 Apr 2010, 17:51
<form action="media.php" name="vbform" method="post" onsubmit="return vB_Editor['{vb:raw editorid}'].prepare_submit(this.inputname.value, {vb:raw vboptions.postminchars})">

You forgot a very important part of form declaration:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Also is good to add a class:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Jaxel
17 Apr 2010, 17:58
The multipart/form-data encoding type shouldn't be required, as I'm not supporting attachments in this form. However, i added both that and the class just to test it out, and neither made a difference (except that the class made the style look ugly, which is why I removed it in the first place).

Buttons still not working.

Vaupell
17 Apr 2010, 18:55
Just use this:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Please note that the last part is to show an editor according to usergroup permissions (eg full WYSIWYG). The first part, is the field name. You can use '' to let it empty.

Maria


Nope still wont transfer "message / bodycontents"

Ive made a video exsample
http://www.screencast.com/t/M2U2ZGU1NGUt

wow screencast stinks,, youtube for the win..
http://www.youtube.com/watch?v=MS2UXqNOA-0

i changed the "Type="POST" to TEST so i get the entire line postet in my URL field
for debugging.. and as seen on the video, message= thats it..


--------------- EDIT / UPDATE

If i change the editor mode to view BBcode (Aa button topright in editor) the text submit fine,
and it submits as wysiwyg=0 then it works.. which is strange..
so it has to be something with the initial setup...


--------------- EDIT / UPDATE 2 - it works if im logged out,
if im logged in, it dosent submit the textarea named message..
got to be login info in the php..


--------------- FINAL EDIT
just using Quick reply box, its the only one working for me..
the full editor got some problems with user permissions..

bpr
02 May 2010, 23:34
@Vaupell

i got the same problem ! but i am not as far as your edits describe - i want to figure out, how it works in a proper way!does anybody know a solution ?

bananalive
03 May 2010, 14:43
The multipart/form-data encoding type shouldn't be required, as I'm not supporting attachments in this form. However, i added both that and the class just to test it out, and neither made a difference (except that the class made the style look ugly, which is why I removed it in the first place).

Buttons still not working.
For Quick Reply to work you need to include the following in the <head>


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



The first is needed for all vB Editors the second javascript file is only needed for quick reply vB Editors.

identitas
04 May 2010, 17:42
Have som problems here. The code:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



When i submit, the data in $_POST['message']; is not the new data from en textarea, it is the old in $profile_data.

Any ideas?

EDIT: It's only in the WYSIWYG-mode that it refuses to save the new data. In the regular mode where the bb-code is visible unformatted it saves without problems.

Jaxel
07 May 2010, 04:59
What exactly does this part do?



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I ask because I want to use my own validation method, and you can't have TWO returns on an onsubmit. If I delete this part, it doesn't seem to have any adverse effects. So what does this do, and why is it needed?

MaryTheG(r)eek
07 May 2010, 05:58
What exactly does this part do?



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I ask because I want to use my own validation method, and you can't have TWO returns on an onsubmit. If I delete this part, it doesn't seem to have any adverse effects. So what does this do, and why is it needed?

You can't remove this if you want to save the data. If you want to add your own validation you can do it in 2 ways:
1.- Add at the end another return. eg


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


2.- This is the way that I'm using. Add your validation in submit button, using "onclick"


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Maria

Jaxel
07 May 2010, 08:51
Alright, thanks for the answer... although I did remove it, and it still saved the data without issue...

However, I have a different question... is there a reason why the editor controls would randomly disappear from the editor? No buttons or smilies are appearing, just the text box.

bananalive
07 May 2010, 16:24
EDIT: It's only in the WYSIWYG-mode that it refuses to save the new data. In the regular mode where the bb-code is visible unformatted it saves without problems.

To the <form> add onsubmit="return vB_Editor['{vb:raw editorid}'].prepare_submit(this.inputname.value, {vb:raw vboptions.postminchars})"

This javascript moves the wysiwyg data into textbox before it submits the form.

Jaxel
07 May 2010, 20:32
Okay... next question... how do I DISABLE the wysiwyg option with a text box?

On my quick reply form, i want it to use the standard editor, with no WYSIWYG option.

--------------- Added 1273268438 at 1273268438 ---------------

I dont think onsubmit="return vB_Editor['{vb:raw editorid}'].prepare_submit(this.inputname.value, {vb:raw vboptions.postminchars})" works correctly. I have that code in my forms, and it still won't save the text when I am in WYSIWYG mode. It still saves perfectly fine in the standard editor.

bpr
12 May 2010, 15:26
so guys, i figured out the problem, that you there is no message if you are in the wysiwyg mode! actually my soluiton is not that pretty, but it works fine.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



in that case i dont give the message to the vB_Editor to check the minimum word amount ... but hell i dont care - i just want a message :P
but that actually result in pure html which will arrive the db

forumdude
25 May 2010, 05:29
Steve,

Do you happen to have the instructions to do this on the 3.8 series archived?

Thanks.

angedelamort
15 Jun 2010, 23:26
Thanks for this great thread. It saved me a lot of time. But I was wondering if it was possible to remove the smilies panel easily only for my mod? Or maybe I should use the WYSIWYG from the quick reply?
If only the second option available, what's the variable name?

--- edit ---
Ok, after looking into the source code I found out:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


the parameter in red is if we want to the smillies or not. Hope it's going to help someone else.

Cadellin
12 Nov 2010, 22:52
so guys, i figured out the problem, that you there is no message if you are in the wysiwyg mode! actually my soluiton is not that pretty, but it works fine.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

in that case i dont give the message to the vB_Editor to check the minimum word amount ... but hell i dont care - i just want a message :P
but that actually result in pure html which will arrive the db

Thank you bpr - I tried using the aaaatest php example with Steve M's template and I got no joy. After using your fix however everything is working.

Does anyone have a "cleaner" solution for the long-term?

jujubins
19 Nov 2010, 19:31
How to disable WYSIWYG advanced editor? I want to use only standart in my mod.


Because in Firefox and IE I cant send with my form.

Or, how I remove a button from tollbar?

FCS-Webmaster
16 Dec 2010, 16:59
I od have a mysterious problem, maybe a handsome guy could lend me a helping hand.
I followed all the instructions down to the end and it works with one simple failure:

When I use the advanced WYSIWG a formated text is stored in my db as plain text.
Any ideas why bbcodes are ripped off?

kind regards

RaidenDAWG2
31 Dec 2010, 02:38
I may have a solution to the WYSIWYG problem here.

Change:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



To



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



And that should take care of the issue. For the WYSIWYG editor to pass the message value to your processing script, it first has to transfer it from the iframe it resides in to the message field in the $_POST variable.

iBaker
05 Sep 2011, 06:03
Does this need to be updated for the new editor or is there a newer How To elsewhere?

Ziki
05 Sep 2011, 09:05
I may have a solution to the WYSIWYG problem here.

Change:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



To



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



And that should take care of the issue. For the WYSIWYG editor to pass the message value to your processing script, it first has to transfer it from the iframe it resides in to the message field in the $_POST variable.

Thank you, that worked!!

Mythotical
23 Sep 2011, 03:18
As I have returned to vBulletin I will be updating this article to work with any changes incurred from 4.0.x to 4.1.x

sweeps78
26 Sep 2011, 14:27
Hi Steve,

Do you have any updates on this? I can't seem to get this to work with 4.1.5.

bananalive
26 Sep 2011, 16:36
Hi Steve,

Do you have any updates on this? I can't seem to get this to work with 4.1.5.


In your php near the beginning:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


In your php file in your main script, you'll need:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



In your template <head>



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



In your template <body>



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

sweeps78
26 Sep 2011, 17:14
Wow! I so wasn't expecting such a quick reply. This worked, thanks!

Now I have to dig into what is the difference between what I was trying to use and what you posted here....

After I realized that the original work doesn't work on 4.1.5, I basically ripped apart newthread.php and newthread template from vb and came up with almost exactly what you posted. I probably left out a semi colon or something:)

Mythotical
26 Sep 2011, 22:28
I will get this updated in the next day or so. Thanks bananalive for the update, I will check the difference and get an update done.

sweeps78
06 Oct 2011, 15:10
Probably a stupid question, but how do we retrieve the text inside the messagearea?

Mythotical
06 Oct 2011, 21:40
When passing the data, it is passed as 'message'.

Easy5s.net
08 Oct 2011, 04:00
pls tut add WYSIWYG to admincp :D

Easy5s.net
27 Oct 2011, 03:24
I integrate it into the admincp but it does not display error icon. :confused:

bipro
03 Nov 2011, 04:39
how to add CKEditor to my custom php page without using TemplateEngine of vbb. Thanks

Cadellin
05 Nov 2011, 19:45
I've come back to this to update my product from the old WYSIWYG to CKEditor and after following the instructions here (http://www.vbulletin.org/forum/showpost.php?p=2250242&postcount=69) I'm just getting an empty box - no editor, text area or buttons.

Could anyone offer any advice what could be going wrong or even offer a clean working version I could try? I'm running the latest 4.1.7 PL2.

A full new article would definitely be worthwhile if someone in the know could spare the time as the old one is now so outdated it's just confusing.

Thanks

Hippy
10 Jan 2012, 12:46
yes could some one explain how to add this new vb editor .. it would be great appreciated

Mythotical
18 Jan 2012, 00:52
I will be testing this on 4.1 platform tonight or tomorrow. First my homework for class then coding. :P

Cadellin
18 Jan 2012, 18:11
I will be testing this on 4.1 platform tonight or tomorrow. First my homework for class then coding. :P

If you get it working I don't suppose you could write up an improved article? It would be great to be able to update my mods to use WYSIWYG once again.

Mythotical
19 Jan 2012, 03:54
If you get it working I don't suppose you could write up an improved article? It would be great to be able to update my mods to use WYSIWYG once again.
Sure will, guaranteed. I'm about to test it now that I'm out of classes until Friday.

--------------- Added 1326984759 at 1326984759 ---------------

So far I have ran into a couple of issues. I will have things ironed out later today and then I'll update my article.

Cadellin
19 Jan 2012, 17:13
I can't tell you how happy that makes me :)

Cheeky I know but could you cover how to load contents into the editor at startup? I.e. Using it to edit something rather than create afresh.

It's something I never managed to find an explanation of how to do in vB-Editor and my own attempts ended in failure. - Thanks!

Hippy
19 Jan 2012, 20:19
thanks steve_m

Mythotical
19 Jan 2012, 21:18
I can't tell you how happy that makes me :)

Cheeky I know but could you cover how to load contents into the editor at startup? I.e. Using it to edit something rather than create afresh.

It's something I never managed to find an explanation of how to do in vB-Editor and my own attempts ended in failure. - Thanks!
I will try to include that.

thanks steve_m
No problem

--------------- Added 1327024413 at 1327024413 ---------------

I have updated the article. I am now testing on the latest release of vBulletin.

Cadellin
21 Jan 2012, 18:25
Thanks Steve :)

Could you clarify by what you mean by "Make sure you have this code in the area where your template containing the editor is to be called" as my editor isn't loading - the smilies etc.. are but there is just a blank space where the editor should be.

Thanks

EDIT: Fixed



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



must be below



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



The example template I originally used to base all my files off has them the other way around so I suspect I won't be the only one.

EDIT2:

Steve could you also advise about parsing the output of the new WYSIWYG? The old one had a special function I seem to remember but I can't find it.

Mythotical
21 Jan 2012, 19:53
Thanks Steve :)

Could you clarify by what you mean by "Make sure you have this code in the area where your template containing the editor is to be called" as my editor isn't loading - the smilies etc.. are but there is just a blank space where the editor should be.

Thanks

EDIT: Fixed



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

must be below



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

The example template I originally used to base all my files off has them the other way around so I suspect I won't be the only one.

EDIT2:

Steve could you also advise about parsing the output of the new WYSIWYG? The old one had a special function I seem to remember but I can't find it.
Make sure you installed the provided plugin. Then you $messagearea where you want it to appear.

If nothing else zip up your files and templates in a file and I'll have a look at it.

Cadellin
21 Jan 2012, 20:01
Thanks Steve - switching around the special templates and includes fixed the issue. My issue now is cleaning up the output from the editor for MYSQL and then parsing it again for display.

Mythotical
21 Jan 2012, 20:37
Thanks Steve - switching around the special templates and includes fixed the issue. My issue now is cleaning up the output from the editor for MYSQL and then parsing it again for display.
Like I said, I'm willing to look over your code for you if you wish. Just let me know.

Cadellin
21 Jan 2012, 23:28
Thanks for the offer Steve but I've now got everything working satisfactorily including editing which is a bonus.

Mythotical
21 Jan 2012, 23:33
Thanks for the offer Steve but I've now got everything working satisfactorily including editing which is a bonus.
Great to hear. Good luck.

Ziki
06 Feb 2012, 17:14
Hm, I can't seem to get it working. Your previous code worked fine after the upgrade, then the editor didn't show up, so I applied the changes bananalive posted, now it shows up but the editor toolbar is not showing up :-/ Any idea what I might be missing?

http://www.kxdesign.com/a/editor.PNG

Ziki
06 Mar 2012, 09:58
Anybody got this working on 4.1.11?

Cadellin
06 May 2012, 12:12
Mine isn't working earlier on 4.1.11. Haven't tried 4.1.12 yet.

Altari
02 Jul 2012, 12:08
I had to add

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



to make it works. Before this, it only displayed a broken basic text area with smileys.