Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: sNews 1.7.1, and editors: whizzywig61.js & CKEditor 3.5.2  (Read 979 times)

sewen

  • Newbie
  • *
  • Karma: 0
  • Posts: 8
sNews 1.7.1, and editors: whizzywig61.js & CKEditor 3.5.2
« on: February 28, 2011, 05:37:13 PM »

What I'm using:

sNews 1.7.1 - UPDATED: February 16, 2011
whizzywig61.js - Whizzywig 61   Featured
CKEditor 3.5.2 - released on 16 February 2011

I took the following lines of code right out of my sites, so this is what I use. 

Note,  I put the function names into the code so you know what functions the code is in.  I put three dots where there are missing lines ... .   And the line numbers are approximate based on a clean snews.php.  So do a search for the code to be on the safe side.

Editor 1 - Whizzywig61 (2 files)
I use Whizzywig editor where I need a small file count.  It does everything I want, but might not be sufficient for my clients.  Example sites: www.greatyoutube.com & www.conspiracy-gov.com

Changes I made to snews.php:


Code: [Select]

remarked out around line 249- , and added the 5 lines of code

function html_input($type, $name, $id, $value, $label, $css, $script1, $script2, $script3, $checked, $rows, $cols, $method, $action, $legend) {
...

/* scott wizziwig editor
if (_ADMIN) {
echo '<script type="text/javascript">';
include('js/admin.js');
echo '</script>';
*/

if (_ADMIN) {
echo '<script type="text/javascript">';
include('js/admin.js');
echo '</script>';
echo '<script type="text/javascript" src="whizzywig61.js"></script>';


remarked out around line 1566- , and added the 9 lines of code

function html_input($type, $name, $id, $value, $label, $css, $script1, $script2, $script3, $checked, $rows, $cols, $method, $action, $legend) {
...

/* scott for wizziwig
case 'textarea':
$output = '<p>'.$lbl.':<br />
<textarea name="'.$name.'" rows="'.$rows.'" cols="'.$cols.'"'.$attribs.'>'.$value.
'</textarea></p>'; break;
*/

case 'textarea':
if (_ADMIN) {
$output = '<textarea name="'.$name.'" id="'.$name.'" rows="'.$rows.'" cols="80"'.$attribs.' style="width:100%; height:30em;">'.$value.'</textarea>
<script type="text/javascript">buttonPath = "buttons/icons.png"; makeWhizzyWig("'.$name.'","all"); </script>'; break;
} else {
$output = '<p>'.$lbl.':
<textarea name="'.$name.'" rows="'.$rows.'"cols="'.$cols.'"'.$attribs.'>'.$value.'</textarea></p>';
}
break;



remarked out around line 3252,  no added code

function file_include($text, $shorten) {
$fulltext = substr($text, 0, $shorten);
//if(substr_count ($fulltext, '&')>0){$fulltext = str_replace('&', '&amp;', str_replace('&amp;', '&', $fulltext));}  // scott
if ($shorten < 9999000 && preg_match('<p>',$fulltext)) {
if (substr_count ($fulltext, '<p>') > substr_count ($fulltext, '</p>')) {
$fulltext .='</p>';
}
}




Editor 2 - CKEditor 3.5.2 (remove _Sample and _Source folders and most language files to get size down to 163 files & 1.6MB)
I use CKEditor where my clients need an easier editor to understand.  Example sites: http://test2.myprofessionaldomains.com

Changes I made to snews.php

Code: [Select]

remarked out around line 2011- , and added the  2 lines of code

function form_articles($contents) {
...

//scott
//echo html_input('textarea', 'text', 'txt', $frm_text, l('text'), '', '', '', '', '', '2', '100', '', '', '');
//buttons();

echo '<script type="text/javascript" src="ckeditor/ckeditor.js"></script>';
echo '<textarea class="ckeditor" cols="80" id="txt" name="text" rows="10">' . $frm_text . '</textarea>';


remarked out around line 3252, no code added

function file_include($text, $shorten) {
$fulltext = substr($text, 0, $shorten);
//if(substr_count ($fulltext, '&')>0){$fulltext = str_replace('&', '&amp;', str_replace('&amp;', '&', $fulltext));}  // scott
if ($shorten < 9999000 && preg_match('<p>',$fulltext)) {
if (substr_count ($fulltext, '<p>') > substr_count ($fulltext, '</p>')) {
$fulltext .='</p>';
}
}




I hope this formats OK.   Most of the time I edit in the raw html, mainly because most editors will re-arrange (format) the html the way they want and I hate that.  But, I do like to have the editors available for my clients.  I thinks SNews and Whizzywig should get together.
Logged