Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Pages: [1] 2 3

Author Topic: [MOD] TinyMCE Editor  (Read 18974 times)

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
[MOD] TinyMCE Editor
« on: May 30, 2007, 02:25:26 AM »

This isn't really a mod as no programming was required, but it could be helpful for some users.

This MOD will transform your comment boxes and administration article writing boxes into textareas using a WYSIWYG editor called TinyMCE. TinyMCE uses javascript, and if javascript is not enabled, the textarea will be like normal.

Simply download TinyMCE here. Unzip it on your hard drive. Navigate through:
tinymce -> jscripts -> and copy folder "tiny_mce" to the root of your website.

Now, in your index.php file, add into the head
Code: [Select]
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas"
});
</script>
Now, in your virgin sNews.php, find
Code: [Select]
echo html_input('button', 'strong', '', 'B', '', 'button', 'onclick="tag(\'strong\')"', '', '', '', '', '', '', '', '');
echo html_input('button', 'em', '', 'I', '', 'button', 'onclick="tag(\'em\')"', '', '', '', '', '', '', '', '');
echo html_input('button', 'strike', '', 'Strike', '', 'button', 'onclick="tag(\'strike\')"', '', '', '', '', '', '', '', '');
echo html_input('button', 'p', '', 'P', '', 'button', 'onclick="tag(\'p\')"', '', '', '', '', '', '', '', '');
echo html_input('button', 'br', '', 'BR', '', 'button', 'onclick="tag(\'br\')"', '', '', '', '', '', '', '', '');
echo html_input('button', 'break', '', 'Break', '', 'button', 'onclick="tag(\'break\')"', '', '', '', '', '', '', '', '');
echo html_input('button', 'img', '', 'Image', '', 'button', 'onclick="tag(\'img\')"', '', '', '', '', '', '', '', '');
echo html_input('button', 'link', '', 'Link', '', 'button', 'onclick="tag(\'link\')"', '', '', '', '', '', '', '', '');
echo html_input('button', 'include', '', 'Include', '', 'button', 'onclick="tag(\'include\')"', '', '', '', '', '', '', '', '');
in the 'articles form' function and delete it (all of it).
Refresh your page(s) and voila!
« Last Edit: August 24, 2007, 04:39:29 PM by ens »
Logged

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
[MOD] TinyMCE Editor
« Reply #1 on: May 30, 2007, 10:39:12 AM »

works very good, thank you ens  :cool:

tayson

  • Newbie
  • *
  • Karma: 0
  • Posts: 5
[MOD] TinyMCE Editor
« Reply #2 on: May 30, 2007, 09:22:23 PM »

Ens, by inserting this code:

Code: [Select]
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
    mode : "textareas"
});
</script>
in <head>, you change all the textareas.
I did this:

Code: [Select]
<? if(strstr ($_GET[action],"admin")){ ?>
   <script language="javascript" type="text/javascript" src="includes/tiny_mce/tiny_mce.js"></script>
   <script language="javascript" type="text/javascript">tinyMCE.init({ mode : "textareas" });</script>
<? } ?>
to change just the administrationīs textarea.
I donīt know if itīs the best way, but is functioning.

  :)
« Last Edit: August 25, 2007, 03:34:43 AM by Phil Martin (Philmoz) »
Logged

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
[MOD] TinyMCE Editor
« Reply #3 on: May 30, 2007, 09:37:06 PM »

You're right tayson, but the mod was originally meant to transform all text areas (including commentboxes for visitors).
Logged

Armen

  • Sr. Member
  • ****
  • Karma: 41
  • Posts: 338
    • http://www.funnydays.ru
[MOD] TinyMCE Editor
« Reply #4 on: May 30, 2007, 11:07:30 PM »

Quote from: ens
You're right tayson, but the mod was originally meant to transform all text areas (including commentboxes for visitors).
I tried this once. Pretty unreliable, because it takes forever to initialize a 300-kb JS every time a page is refreshed. Besides not all tags are allowed for guests, so there's gonna be garbage in comments. And in my snews I use bbcode, so tags are just stripped.
Logged
Now ogres, oh, they're much worse. They'll make a suit from your freshly peeled skin. They'll shave your liver, squeeze the jelly from your eyes... Actually, it's quite good on toast.

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
[MOD] TinyMCE Editor
« Reply #5 on: May 30, 2007, 11:10:59 PM »

Hey, but for some people, thats what they want.

And when the multi-user mod comes out, it'll be handy.

(ooh yay! my 100th post!)
Logged

desdevlover

  • Guest
[MOD] TinyMCE Editor
« Reply #6 on: June 17, 2007, 08:41:30 AM »

Pls help me, This mod does not work with me.
I was edited files via tayson introductions but WYSIWYG not working fine?
Logged

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
[MOD] TinyMCE Editor
« Reply #7 on: June 21, 2007, 11:30:06 PM »

Quote from: desdevlover
Pls help me, This mod does not work with me.
I was edited files via tayson introductions but WYSIWYG not working fine?
Make sure the path to your TinyMCE is correct :
Code: [Select]
src="includes/tiny_mce/tiny_mce.js"Change that if necessary.
Logged

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
[MOD] TinyMCE Editor
« Reply #8 on: June 21, 2007, 11:51:00 PM »

Quote from: tayson
Ens, by inserting this code:

Code: [Select]
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
    mode : "textareas"
});
</script>
in <head>, you change all the textareas.
I did this:

Code: [Select]
<? if(strstr ($_GET[action],"admin")){ ?>
   <script language="javascript" type="text/javascript" src="includes/tiny_mce/tiny_mce.js"></script>
   <script language="javascript" type="text/javascript">tinyMCE.init({ mode : "textareas" });</script>
<? } ?>
to change just the administrationīs textarea.
I donīt know if itīs the best way, but is functioning.

  :)
Tayson, it's not working for me. how exactly did you do this?
« Last Edit: August 25, 2007, 03:35:12 AM by Phil Martin (Philmoz) »
Logged

edsil

  • Jr. Member
  • **
  • Karma: 5
  • Posts: 97
[MOD] TinyMCE Editor
« Reply #9 on: June 22, 2007, 09:29:06 AM »

Hi ens!

well I apply tinyMCE like this:
in the index.php, just under favicon, and before "</head>" I put:

Code: [Select]
<!-- Javascript  tinyMCE -->
<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
        <script language="javascript" type="text/javascript">
        tinyMCE.init({
            mode : "textareas",
            theme : "advanced",
            editor_selector : "mceEditor",
            language : "en",
plugins : "imagemanager,filemanager,table,advhr,advimage,advlink,iespell,insertdatetime,flash,searchreplace,contextmenu",
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_buttons1_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,flash,backcolor",
            width : "485",
            height : "300"
            });
            </script>
Then, into snews.php, I do like you said, to erase:

Code: [Select]
   echo html_input('button', 'strong', '', 'B', '', 'button', 'onclick="tag(\'strong\')"', '', '', '', '', '', '', '', '');
    echo html_input('button', 'em', '', 'I', '', 'button', 'onclick="tag(\'em\')"', '', '', '', '', '', '', '', '');
    echo html_input('button', 'strike', '', 'Strike', '', 'button', 'onclick="tag(\'strike\')"', '', '', '', '', '', '', '', '');
    echo html_input('button', 'p', '', 'P', '', 'button', 'onclick="tag(\'p\')"', '', '', '', '', '', '', '', '');
    echo html_input('button', 'br', '', 'BR', '', 'button', 'onclick="tag(\'br\')"', '', '', '', '', '', '', '', '');
    echo html_input('button', 'break', '', 'Break', '', 'button', 'onclick="tag(\'break\')"', '', '', '', '', '', '', '', '');
    echo html_input('button', 'img', '', 'Image', '', 'button', 'onclick="tag(\'img\')"', '', '', '', '', '', '', '', '');
    echo html_input('button', 'link', '', 'Link', '', 'button', 'onclick="tag(\'link\')"', '', '', '', '', '', '', '', '');
    echo html_input('button', 'include', '', 'Include', '', 'button', 'onclick="tag(\'include\')"', '', '', '', '', '', '', '', '');
and after I put:

Code: [Select]
?><p><textarea name="text" class="mceEditor"><? echo $frm_text; ?></textarea><?It is working for me, and no problem... hope this help you :)
« Last Edit: August 25, 2007, 03:35:28 AM by Phil Martin (Philmoz) »
Logged

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
[MOD] TinyMCE Editor
« Reply #10 on: June 23, 2007, 04:25:40 PM »

You're right, this works perfectly. Thanks edsil!
Logged

edsil

  • Jr. Member
  • **
  • Karma: 5
  • Posts: 97
[MOD] TinyMCE Editor
« Reply #11 on: June 23, 2007, 11:52:49 PM »

Nice to know this help you :)
Logged

jeepnstein

  • Newbie
  • *
  • Karma: 0
  • Posts: 3
[MOD] TinyMCE Editor
« Reply #12 on: July 26, 2007, 07:23:13 PM »

Edsil,

You have just saved me a ton of work.  Thanks so much.   I needed a good editor for Rui's TUGA Mod.  This is just the ticket.

Jim
Logged

redman

  • Guest
[MOD] TinyMCE Editor
« Reply #13 on: August 13, 2007, 12:24:43 PM »

I would like enjoyment TyniMCE (theme: simple)  near commentboxes for visitors, TinyMCE me functions in the same way how introduced ens, but me portrayals only when be logged like admin, doesn't know somebody how permit TyniMCe near   commentboxes for visitors  ?
Logged

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
[MOD] TinyMCE Editor
« Reply #14 on: August 18, 2007, 07:38:46 AM »

this snippet loads the js script only for editting.
Code: [Select]
<? if( $_GET['action'] == "admin_article"){ ?>
................. js code
<? } ?>
i would like the js script to load when admin add new article,extra,page and when editting the content ( article,extra,page, comments )

any idea for how to do it ?
thanks
« Last Edit: August 25, 2007, 03:35:48 AM by Phil Martin (Philmoz) »
Logged
Pages: [1] 2 3