Topics

User Functions

Events

There are no upcoming events

What's New

Stories

1 new Stories in the last 2 weeks

Comments last 2 weeks


Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Saturday, May 25 2013 @ 04:24 PM EDT


 Forum Index > Extensions > Cool Hacks New Topic Post Reply
 TinyMCE and GL 1.3.11 - integration instruction
   
Robin
 10/03/05 09:19AM (Read 6371 times)  
+++++
Full Member

Status: offline


Registered: 02/15/02
Posts: 725
I've decided to write this because this is by far the easiest integration of a WYSIWG editor with Geeklog. Hopefully you'll find it usefull.
1. First of all go to TinyMCE website and grab a copy of the editor in their Download section.

2. Unpack the archive into your public_html directory. You should have a directory called tinymce created.

3. In a header.thtml file of your theme, after title tag paste this piece of code

PHP Formatted Code
<script language="javascript" type="text/javascript" src="{site_url}/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>











 


4. If you want this feature available for everyone, read on, if TinyMCE is for Story Admins only go to point 5.
You keep reading this meaning you want this for everyone
Do the following:
- copy the submitstory.thtml into submitstory_advanced.thtml
- edit the submitstory_advanced.thtml file and add this piece of code at the begining of the file
PHP Formatted Code
<script language="javascript" type="text/javascript">
        // Notice: The simple theme does not use all options some of them are limited to the advanced theme
        tinyMCE.init({
                mode : "textareas",
                theme : "simple"
        });
</script>












 

- save it

5. To enable TinyMCE for Story Admins do the following:
- copy the storyeditor.thtml into storyeditor_advanced.thtml
- edit storyeditor_advanced.thtml and add the following piece of code at the begining of the file
PHP Formatted Code
<script language="javascript" type="text/javascript">
        // Notice: The simple theme does not use all options some of them are limited to the advanced theme
        tinyMCE.init({
                mode : "textareas",
                theme : "advanced"
        });
</script>












 

- save it
6. Now edit your config.php
go to
PHP Formatted Code
$_CONF['advanced_editor'] = false;











 

and set it to true.
Go to
PHP Formatted Code
$_CONF['postmode']      = 'plaintext';  // can be 'plaintext' or 'html'










 
and set it to html
Save it

7. Go edit your lib-common.php
go to
PHP Formatted Code
function COM_refresh( $url )
{
    return "<html><head><meta http-equiv="refresh" content="0; URL=$url"></head></html>n";
}







 

and change to this
PHP Formatted Code

function COM_refresh( $url )
{
header ("Location: " . str_replace ( '&amp;', '&', $url) );
return "<html><head><meta http-equiv=\"refresh\" content=\"0; URL=$url\"></head></html>n";
}










 


This solves the issue described in this thread

Final notes:
You will have to update the $_CONF['user_html'] and $_CONF['admin_html'], but it's up to you what you want to make available. For sure you will have to add strong tag to $_CONF['user_html'] because regular bold seems to be malfunctioning (this has been discussed here) . This editor has a lot more to offer and once you have it running do not hesitate and experiment

Good luck
--EDIT--
I updated the bit that goes to lib-common.php COM_refresh. Thanks to heretic

Geeklog Polish Support Team
 
Profile Email Website
 Quote
SidiMustafa
 10/03/05 11:37AM  
+----
Newbie
awake

Status: offline


Registered: 09/12/05
Posts: 12
Hi, very well put together HOW-TO,

I tried it out, but when i did a page refreshed, i realized that i was not able to get into my website....

Somehow i remembered i had this problem before, and noted that it was because of sound erronous code in the lib-common.php

So i started looking into your code, step by step...after a while i realized that it's supposed to be this:

PHP Formatted Code

function COM_refresh( $url )
{
header ("Location: " . str_replace ( '&', '&', $url) );
    return "<html><head><meta http-equiv="refresh" content="0; URL=$url"></head></html>n";
}

 


instead of what u had posted....

bascailly what i realized was that the "" was missing between "refresh" "content" etc...

but do hope, i was correct. cause once i made those changes, it worked flawlessy..

regards
sidi


PS NOTE...
Now, Now, while previewing my message, i realized exactly what the problem is......
In the code provided by the original poster, the "backslash" in the lib-common.php is missing...

I tried to post the correct code, thinking it was a typo, but while previewing before posting, i realized that all "backslashes" are automatically removed (filterd out by the forum software)..

So, if u are going to implement this, please double check your coding in the lib-common.php....after doing a copy and paste from the posters code

Check your old code, and look for those missing backslashes

~~~ The science of doing it right ~~~
 
Profile Email Website
 Quote
Robin
 10/03/05 11:50AM  
+++++
Full Member

Status: offline


Registered: 02/15/02
Posts: 725
Well spotted SidiMustafa
Thank you
Robert

Geeklog Polish Support Team
 
Profile Email Website
 Quote
yankidank
 10/03/05 01:25PM  
++---
Junior

Status: offline


Registered: 04/03/05
Posts: 17
How difficult would this be to integrate into the forums of a geeklog site?

By the way, thanks for the instructions. I have it working like a charm on my own site. If anyone wants to see what it looks like use the link above. I altered some of the code for the row and colum size to make it fit properly.

 
Profile Email Website
 Quote
SidiMustafa
 10/03/05 02:08PM  
+----
Newbie

Status: offline


Registered: 09/12/05
Posts: 12
Hi Yankidank

Two things, do u care to share the code that u used to adjust the settings of tinymce, i was trying to get it adjusted myself, my my small knowled of coding, didn't reach to far..

thanks in advance

next, according to the site of TinyMce, it's O/S, Platform independant, so i guess, it should be easy to get it work in the forum software,
I don't know which forum software u are using, but i did a fast search on GOOGLLLLLLEEE,
with TinyMCE and PHPBBB, and found lots of of hits

~~~ The science of doing it right ~~~
 
Profile Email Website
 Quote
Anonymous: ldfoo
 10/03/05 05:55PM  



Hi
Interesting, I don't know if this should be the case but found the tiny_mce code in the header slowed down my site when using a full implementation. Putting the code normally put in the header, directly at top of storyeditor_advanced.thtml gave faster overall site performance while giving full editor access to admin.

PHP Formatted Code
<!-- tinyMCE -->
<script language="javascript" type="text/javascript" src="../../tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
        tinyMCE.init({
                mode : "specific_textareas",
        theme : "advanced",
                plugins : "table,advhr,advimage,paste,contextmenu,ibrowser,imanager,fullscreen,advlink,emotions,insertdatetime,preview,flash,searchreplace,print",
                theme_advanced_buttons1_add_before : "fontselect,fontsizeselect",
                theme_advanced_buttons1_add : "",
                theme_advanced_buttons2_add : "ibrowser,separator,insertdate,inserttime,preview,separator",
                theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
                theme_advanced_buttons3_add_before : "fullscreen,imanager,tablecontrols,separator,pastetext,pasteword",
                theme_advanced_buttons3_add : "emotions,flash,advhr,separator,print,forecolor,backcolor",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                theme_advanced_path_location : "bottom",
        plaintext_create_paragraphs : "false",
                content_css : "example_full.css",
            plugin_insertdate_dateFormat : "%d-%m-%y",
            plugin_insertdate_timeFormat : "%H:%M:%S",
                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]",
                external_link_list_url : "example_link_list.js",
                external_image_list_url : "example_image_list.js",
                flash_external_list_url : "example_flash_list.js"
//              file_browser_callback : "fileBrowserCallBack"
        });

//      function fileBrowserCallBack(field_name, url, type) {
                // This is where you insert your custom filebrowser logic
//              alert("Filebrowser callback: " + field_name + "," + url + "," + type);
//      }
</script>
<!-- /tinyMCE -->
 


BTW - The Geeklog cvs has a very nice editor implementation using fckeditor - I haven't tested it for overall site speed on a shared hosting server but will be nice if the speed problems I found with tiny_mce are overcome

 
 Quote
yankidank
 10/03/05 10:41PM  
++---
Junior

Status: offline


Registered: 04/03/05
Posts: 17
In response to SidiMustafa:

Open up the storyeditor_advanced.thtml and submitstory_advanced.thtml and edit the line that looks like:

PHP Formatted Code
<td><textarea name="introtext" cols="75" rows="20" wrap="virtual">{story_bodytext}</textarea></td>
 


That's not the original code, that's what I changed it to so that it would fit my site better. Just change the cold and rows numbers until it fits. You will want to do this with 2 lines in the storyeditor_advanced.thtml file. Once for story_introtext and once for story_body text just below it. submitstory_advanced.thtml only has one area to change.

 
Profile Email Website
 Quote
beewee
 10/04/05 08:03AM  
+++++
Full Member

Status: offline


Registered: 08/05/03
Posts: 969
Does the Admin has an image upload facility? And cropping/resizing?

**EDIT/UPDATE**

from TinyMCE site:
We just released updated versions of MCFileManager and MCImageManager, a lot of backend changed on these versions, fixes and extra options added. We included language support for them as well, currently only Swedish and English.

Dutch Geeklog sites about camping/hiking: www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 
Profile Email Website
 Quote
Anonymous: ldfoo
 10/04/05 09:15AM  




The iBrowser plugin is very well featured third party plugin suited to several editors incl tiny_MCE . It allows upload and manipulation. The author also has a file manager plugin available from the same site.

rgds

 
 Quote
yankidank
 10/04/05 02:00PM  
++---
Junior

Status: offline


Registered: 04/03/05
Posts: 17
Is it possible to integrate this into the forum plugin? I'm not sure what I would lose or gain by doing this.

 
Profile Email Website
 Quote
kreative
 11/03/05 03:23PM  
+++--
Chatty

Status: offline


Registered: 08/15/04
Posts: 53
Hello friends,
thanks for this topic, I just installed TiniMCE and it works ok!

I have only a problem: BOLD letters don't are bold, they become plain test.. I am unable to make bold words.... I see the words in bold when I'm in the editor window, but when I read the home page of my site all letters return in plain format. Links and other features works ok.

Any suggestion for my problem?
Thanks!

 
Profile Email Website
 Quote
kreative
 11/04/05 05:15AM  
+++--
Chatty

Status: offline


Registered: 08/15/04
Posts: 53
OK I solved the "bold" question but I have another problem: "mailto:" links don't works, example:

Link: mailtoxx@xxx.com
Converted to: http://www.mysite.com/xxx@xxx.com

TinyMCE converts mailto: in my site address.

Can someone help me?

 
Profile Email Website
 Quote
Anonymous: Theophile
 11/04/05 10:34AM  



How did you solve the bold issue?

 
 Quote
Robin
 11/04/05 11:02AM  
+++++
Full Member

Status: offline


Registered: 02/15/02
Posts: 725
Dear Theophile, have you carefully read the first post in this thread
Quote by Robin:
Final notes:
You will have to update the $_CONF['user_html'] and $_CONF['admin_html'], but it's up to you what you want to make available. For sure you will have to add strong tag to $_CONF['user_html'] because regular bold seems to be malfunctioning (this has been discussed here) .

Geeklog Polish Support Team
 
Profile Email Website
 Quote
Dirk
 11/04/05 02:12PM  
AAAAA
Admin

Status: offline


Registered: 01/12/02
Posts: 13027
Quote by kreative: TinyMCE converts mailto: in my site address.

You have to add it to the list of allowed protocols in config.php:
PHP Formatted Code
// list of protocols that are allowed in links                                
$_CONF['allowed_protocols'] = array ('http', 'https', 'ftp');
 

But then again, who really uses mailto: any more? Any email address you enter there will only attract spam ...

bye, Dirk

 
Profile Email Website
 Quote
kreative
 11/05/05 02:04AM  
+++--
Chatty

Status: offline


Registered: 08/15/04
Posts: 53
Hmmm.. Dirk, do you suggest me to use the mail form instead the mailto: ?

 
Profile Email Website
 Quote
Dirk
 11/05/05 03:30PM  
AAAAA
Admin

Status: offline


Registered: 01/12/02
Posts: 13027
Quote by kreative: Dirk, do you suggest me to use the mail form instead the mailto: ?

That's what I'd do.

bye, Dirk

 
Profile Email Website
 Quote
Content generated in: 3.25 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
Filtered HTML Allowed 
Censored Content