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 18977 times)

mico75

  • Newbie
  • *
  • Karma: 8
  • Posts: 9
Re: [MOD] TinyMCE Editor
« Reply #30 on: October 09, 2007, 11:06:57 AM »

One more option and the one I use is this...

Code: [Select]
<? if ($_SESSION[db('website').'Logged_In'] == token()) { ?>
   <script language="javascript" type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
   <script language="javascript" type="text/javascript">tinyMCE.init({ theme : "advanced", mode : "textareas", plugins : "insertdatetime", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_buttons1_add : "insertdate", plugin_insertdate_dateFormat : "%m %d, %Y" });</script>
<? } ?>

If you logged in then you get TinyMCE otherwise you get the standard text box.

Thanks urbitas! Just nice little script  :)
And what I did to make me easier when changing template:

I made short php script, let's call it: tinymce_load.php containing these lines:
Code: [Select]
<?php

function tinymce_if_login() {
    if (
$_SESSION[db('website').'Logged_In'] == token()) { 
        echo 
'<script language="javascript" type="text/javascript" src="js/tiny_mce/tiny_mce.js"></script>';
        echo 
'<script language="javascript" type="text/javascript">';
        echo 
'tinyMCE.init({ theme : "advanced",mode : "textareas", plugins : "insertdatetime", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_buttons1_add : "insertdate", plugin_insertdate_dateFormat : "%m %d, %Y", width : "485", height: "300"});';
        echo 
'</script>';
    }
}
?>


Then a little adjustment in index.php, add blue one:
<?php session_start(); include('snewsMU.php'); include('tinymce_load.php'); ?>

and then inside <head> section:
Code: [Select]
<?php tinymce_if_login(); ?>
Logged
MicS
Pages: 1 2 [3]