Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-17-2006, 08:42 PM
Constant Pligger
 
Join Date: Mar 2006
Posts: 575
Thanks: 14
Thanked 126 Times in 61 Posts
WYSIWYG Editor

Not really a mod, just an integration of a cross-browser wysiwyg editor that is easy to set up and use. It now works well on my pligg installation, after some initial problems with conflicting javascript loading.

1.) Download the attached editor package, unzip and upload the folder 'editor' to your pligg root directory. It uses the tiny_mce editor (the best option in my opinion).

2.) Add the code below to the very end of your footer.tpl template file:

Code:
<!--WYSIWYG Editor -->
<script language="javascript" type="text/javascript" src="{$my_base_url}{$my_pligg_base}/editor/tiny_mce_gzip.php"></script>
{literal}
<script language="javascript" type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    theme_advanced_buttons1 : "bold,italic,underline,forecolor,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,undo,redo,link,unlink,separator,code",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_path_location : "bottom",
    extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
});
</script>
{/literal}
<!--// WYSIWYG Editor -->
You can alter the size of the displayed editor by changing the rows and cols values associated with any <textarea> tags, in templates such as comment_form.tpl and submit_step_2.tpl. To customise the look of the editor, you can add or remove buttons in the "theme_advanced_buttons1" line of the script above.

PS. if anyone knows of a conditional to only display the footer script when there is a <textarea> tag present, please post!
Attached Files
File Type: zip WYSIWYG Editor.zip (406.1 KB, 176 views)
__________________

Reply With Quote
  #2 (permalink)  
Old 05-22-2006, 02:01 PM
3dKiller's Avatar
Constant Pligger
 
Join Date: Mar 2006
Location: Newport Beach
Posts: 142
Thanks: 24
Thanked 2 Times in 1 Post
Simon,

I tried this out on your demo site (in Firefox 1.5.0.3), but it didn't give the desired results. Yes, it works within the editor itself, but does not print correctly in comments after posting.

I would love to see this work, with spell check! Thanks for trying.

~3d
Reply With Quote
  #3 (permalink)  
Old 05-23-2006, 10:31 AM
Casual Pligger
 
Join Date: Dec 2005
Location: Brooklyn, NY
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to KingPin Send a message via AIM to KingPin Send a message via MSN to KingPin Send a message via Yahoo to KingPin
it probably wont print out correctly till you allow the html commands used in the editor in your config.cfg file
Reply With Quote
  #4 (permalink)  
Old 05-23-2006, 02:36 PM
3dKiller's Avatar
Constant Pligger
 
Join Date: Mar 2006
Location: Newport Beach
Posts: 142
Thanks: 24
Thanked 2 Times in 1 Post
Quote:
Originally Posted by KingPin
it probably wont print out correctly till you allow the html commands used in the editor in your config.cfg file
KingPin,

Thanks for info. I'm wondering if anyone has tried this, and got it to work?

~3d
Reply With Quote
  #5 (permalink)  
Old 05-25-2006, 10:26 AM
New Pligger
 
Join Date: Apr 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
hi guys do you know if this is working? Great idea btw!
__________________
Mike K.
BARKSBookmARKS.com
BARKS=BookmARKS
Reply With Quote
  #6 (permalink)  
Old 05-25-2006, 11:03 AM
AshDigg's Avatar
Coder
 
Join Date: Dec 2005
Posts: 1,574
Thanks: 235
Thanked 345 Times in 206 Posts
The next step is to open submit_step_3.tpl in your templates folder and change line 17 from

$linkres->content = strip_tags(trim($_POST['bodytext']), Story_Content_Tags_To_Allow);


to

$linkres->content = trim($_POST['bodytext']);
__________________
- Ash
Reply With Quote
  #7 (permalink)  
Old 05-25-2006, 01:31 PM
New Pligger
 
Join Date: Apr 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Ash. As always, much appreciated!!!

Any thoughts as to if this will be added as part of the standard package?
__________________
Mike K.
BARKSBookmARKS.com
BARKS=BookmARKS
Reply With Quote
  #8 (permalink)  
Old 05-25-2006, 07:21 PM
AshDigg's Avatar
Coder
 
Join Date: Dec 2005
Posts: 1,574
Thanks: 235
Thanked 345 Times in 206 Posts
There are still some bugs to be worked out before it can be added. Like if there are too many lines of text, the "comments" form gets squished and you can't enter comments. Once we get little things like that worked out it'll be added as an option in the config.php file.
__________________
- Ash
Reply With Quote
  #9 (permalink)  
Old 07-20-2006, 10:55 AM
Casual Pligger
 
Join Date: Dec 2005
Posts: 31
Thanks: 0
Thanked 3 Times in 2 Posts
Send a message via AIM to williamboliver Send a message via MSN to williamboliver Send a message via Yahoo to williamboliver Send a message via Skype™ to williamboliver
I modified the lines of text in my template and have the editor working great. I decided to get a little adventurous and add spellcheck to the editor plugins. With firefox, it works great. In IE6 I get a runtime error. Has anyone else figured out a way to get the spellcheck plugin working with IE? I think this issue is in the compression page, but not sure how to track it down and debug.
Reply With Quote
  #10 (permalink)  
Old 07-20-2006, 11:02 AM
3dKiller's Avatar
Constant Pligger
 
Join Date: Mar 2006
Location: Newport Beach
Posts: 142
Thanks: 24
Thanked 2 Times in 1 Post
@ash - This would be a nice feature for the 'editorial/blog' function, otherwise - pass.

@williamboliver - URL?

~3d
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use WYSIWYG editor? bryancxw General Help 3 07-30-2008 10:02 AM
BBcode editor for submission? ivytony Modification Tutorials 0 03-19-2008 12:31 AM
Rich text Editor Lostshootingstar Off-topic 1 01-08-2008 06:57 PM
Changing Text Editor anandn General Help 0 12-21-2007 10:15 AM
turn any <textarea> into a powerful WYSIWYG editor. noyp Suggestions 0 01-28-2007 10:04 AM


Search Engine Friendly URLs by vBSEO 3.2.0