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

Author Topic: FCKeditor and sNews1.6  (Read 12406 times)

3Pinter

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 61
    • Fromthemill.nl
FCKeditor and sNews1.6
« on: October 04, 2007, 09:34:53 PM »

Hi,

If you want to use FCKeditor and sNews1.6.
(assuming:
* you downloaded the latest version of fckeditor.net
* you configured fckeditor properly (assuming I did...)

What I did:

In index.php, in your <head> add:
Code: [Select]
<script type="text/javascript" src="fckeditor/fckeditor.js">
// assuming fckeditor.js is in the root/fckeditor directory</script>

In snews.php add at the bottom:
[code]
function jseditor() {
?>
    <script type="text/javascript">

        window.onload = function()
        {
            var oFCKeditor = new FCKeditor( 'txt' ) ;
            oFCKeditor.BasePath = '/fckeditor/' ;    // '/fckeditor/' is the default value.
oFCKeditor.ToolbarSet = "yourcustomhereifyoumadeone";
oFCKeditor.Height = "600" ;
            oFCKeditor.ReplaceTextarea() ;
        }

    </script>

<?php
}

Locate:
Code: [Select]
function form_articles($contents) {and in that function:
Code: [Select]
echo html_input('textarea', 'text', 'txt', $frm_text, l('text'), '', '', '', '', '', '2', '100', '', '', '');replace it with:
Code: [Select]
jseditor();
echo html_input('textarea', 'text', 'txt', $frm_text, l('text'), '', '', '', '', '', '2', '100', '', '', '');
//you can comment out the buttons below this echo...

It doesn't work when you start a NEW article
(textarea is not replaced with the editor)

HOWEVER

It works great when:
* you start editting a article
* you start a new article and submits it without filling in the required fields (the error shows, and afterwards the textarea is replaced with the editor)


Does anybody has a solution why it's not working when I create a new article?

Thanks for your reply, and hopefully we can get this one working!

3Pinter[/code]
« Last Edit: April 10, 2009, 05:24:21 PM by Patric Ahlqvist »
Logged

mosh

  • Dev Invitee
  • Hero Member
  • *****
  • Karma: 77
  • Posts: 521
  • Awesome day :)
Re: FCKeditor and sNews1.6
« Reply #1 on: October 05, 2007, 02:18:34 PM »

hey  8)

i use fckeditor with php connector,

in index.php add this ---> include("fckeditor/fckeditor.php");
in snews.php ---> find function form_articles and comment out this line
Code: [Select]
echo html_input('textarea', 'text', 'txt', $frm_text, l('text'), '', '', '', '', '', '2', '100', '', '', '');
and replace / comment out this part (include opning and closing <p> tag)
Code: [Select]
echo '<p>';
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\')"', '', '', '', '', '', '', '', '');
echo '</p>';

with this code --->
Code: [Select]
echo "<div class=\"editor\">";
        $oFCKeditor = new FCKeditor('text') ;
        $oFCKeditor->BasePath = '/YOURSITE/fckeditor/';
        $oFCKeditor->Value = stripslashes($r['text']);
$oFCKeditor->Width  = '98%' ;
$oFCKeditor->Height = '550' ;
$oFCKeditor->ToolbarSet = 'Basic' ;
        $oFCKeditor->Create() ;
echo "</div>";

you can change the fck settings as you like,
hope it help
awesome day
Logged

3Pinter

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 61
    • Fromthemill.nl
Re: FCKeditor and sNews1.6
« Reply #2 on: October 05, 2007, 06:50:15 PM »

Mosh,

I did as you typed, however I get this message:
Fatal error: Class 'FCKeditor' not found in /root/sites/site100/web/test/snews.php on line 1353
line 1353 gives:$oFCKeditor = new FCKeditor('text') ;

? how to solve this?

3Pinter

mosh

  • Dev Invitee
  • Hero Member
  • *****
  • Karma: 77
  • Posts: 521
  • Awesome day :)
Re: FCKeditor and sNews1.6
« Reply #3 on: October 05, 2007, 08:44:14 PM »

i have try to remake that error, but could not.
sry, no idea why this error  ???
Logged

Rui Mendes

  • Development,Testing, Support
  • sNews Dude
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1039
  • sNews1.7
    • Comunidade Portuguesa
Re: FCKeditor and sNews1.6
« Reply #4 on: October 05, 2007, 08:44:55 PM »

Really I don't remember, my first mod for sNews was fckeditor with snews 1.5.30 my first post

I'm sorry I lose the file, but I know you must change something inside fckeditor first. I just give up this mod because mess my xtml code.

I found one example for my brother, click here to download. You can view the code, try find "fck" and see what I did with my friend Bruno Silva.

I'm sorry I'm busy this next days.
Logged
Need a Job on Europe. Linkdin - Facebook / Group

3Pinter

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 61
    • Fromthemill.nl
Re: FCKeditor and sNews1.6
« Reply #5 on: October 06, 2007, 07:55:32 AM »

Rui Mendes, Mosh,

thanks for your replies, I'll have a look at the examplefckeditor.zip.

I think it has something to do with the path's.

It includes the file .php correctly, etc.etc. however there error tells it can't 'find' class fckeditor. And the definition is found in the included .php file so that's strange isn't it.

But now I'm going to my brother and I'll be gone for the weekend, I'll get back to this about monday.

3Pinter

ramppi

  • Newbie
  • *
  • Karma: 0
  • Posts: 15
Re: FCKeditor and sNews1.6
« Reply #6 on: October 06, 2007, 08:07:58 AM »

Hi, bit long post but clear

More to 'mosh's' post - working FCKEditor.

In this example snews (vers MUAM) is in root folder 'snewsmu'
ie http://snewscms.net/snewsmu/

A to D How To:
download upload 'fckeditor' folder with your snews

A INDEX.PHP CONF
in your index.php place
<?php include("fckeditor/fckeditor.php"); ?>
(I put it under 'snews include' ie 2nd line)

B SNEWS.PHP CONF
in snews.php (line ~1310 - MUAM line ~1900) find:

Quote
   echo html_input('textarea', 'text', 'txt', $frm_text, l('text'), '', '', '', '', '', '2', '100', '', '', '');
   echo '<p>';
   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\')"', '', '', '', '', '', '', '', '');
   echo '</p>';


and replace it with:

Quote
echo "<div class=\"editor\">";
        $oFCKeditor = new FCKeditor('text') ;
        $oFCKeditor->BasePath = 'fckeditor/';
        $oFCKeditor->Value = stripslashes($r['text']);
      $oFCKeditor->Width  = '100%' ;
      $oFCKeditor->Height = '550' ;
      $oFCKeditor->ToolbarSet = 'Default' ;
        $oFCKeditor->Create() ;
echo "</div>";

-change BasePath (Width, Height) to fit/suite
-ToolbarSet: You can modify it asyoulike later in 'fckconfig.js'

C FCKeditor CONF
in 'fckeditor/fckconfig.js' (~lines 186,187 change (default) 'asp' to 'php' - below)

var _FileBrowserLanguage   = 'php' ;   // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage   = 'php' ;   // asp | aspx | cfm | lasso | php

-ToolbarSet: Modify it suitable - delete unwanted "options/buttons"

D UPLOADING CONF (filemanager)
create/choose a folder for uploading stuff (here we created folder '/files' in snewsmu directory) fck creates some subfolder(s) and you can create too when managing
'snewsmu/files/' chmod your '/files' 777

in 'fckeditor/editor/filemanager/browser/default/connectors/php/config.php'
(line 28) $Config['Enabled'] = true ; <- we change it to 'true' (default false)

(line 32) $Config['UserFilesPath'] = '/snewsmu/files/' ; <- root path for the folder created/choosed above here

C ONE HINT MORE
(It is known that some Linux installations may cause problems with Firefox - if so: rename htaccess.txt included in fckeditor folder to .htaccess)

D Like to have some touch & test fck a bit
http://snewscms.net/snewsmu/
log: snewsmu/snewsmu - please, don't mess a lot (you can delete your rehersals) - for intelligent use for a while

kind regards
matti
Logged

dhn

  • Newbie
  • *
  • Karma: 0
  • Posts: 15
Re: FCKeditor and sNews1.6
« Reply #7 on: October 09, 2007, 05:54:22 PM »

hi guys.. everything went fine until i tried upload... I keep getting:

Your server returned an XML error !!



Any ideas ?



DHN
Logged

Rui Mendes

  • Development,Testing, Support
  • sNews Dude
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1039
  • sNews1.7
    • Comunidade Portuguesa
Re: FCKeditor and sNews1.6
« Reply #8 on: October 09, 2007, 07:21:31 PM »

As I said before "I just give up this fckeditor because mess my xtml code." for non english.
I don't know if they fix xhtm. This editor is the best.

If you get error when upload files, please check files inside fckeditor maybe miss userfiles folder.
Try: fckconfig and inside folder editor/filemanager for upload and download

I don't remember what files you need to change, just view: config, php,...



Logged
Need a Job on Europe. Linkdin - Facebook / Group

3Pinter

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 61
    • Fromthemill.nl
Re: FCKeditor and sNews1.6
« Reply #9 on: October 09, 2007, 08:14:05 PM »

Yeah, I like FCKeditor also very much.

And finally I've solved my problem (see #1 post). Right now I'm using the php version instead of javascript (great because I don't always have js activated).

The problem was as I suspected a path problem.
How I solved it? putting a error report_all in my index.php.... omg how many errors there are in snews.... jeeeee....

Anyways, declaring some not-yet-defined-variables and correct path issues did the trick.


Thanks for input, great editor give it a shot I would like to suggest.

(hopefully the add-on (filebrowsing, incl preview etc) will become free for use)


3Pinter

ramppi

  • Newbie
  • *
  • Karma: 0
  • Posts: 15
Re: FCKeditor and sNews1.6
« Reply #10 on: October 10, 2007, 05:47:54 AM »

If You integrate FCKeditor with the steps in my post above, everything should be just fine.

Dhn, check steps C and D in my post. Ie change to php and name,chmod & check path for the folder where you upload.
It solved my xml + permission errors.
Working example:
http://snewscms.net/snewsmu/  (log: snewsmu/snewsmu)

You can download fckeditor-php (cleaned from extra) for snews with readme:
http://snewscms.net/fck-php-for-snews.zip
« Last Edit: October 10, 2007, 06:53:12 AM by ramppi »
Logged

dhn

  • Newbie
  • *
  • Karma: 0
  • Posts: 15
Re: FCKeditor and sNews1.6
« Reply #11 on: October 13, 2007, 09:51:20 PM »

Hi Guys

thank you for the download, everything is working perfect now...  ;D
Logged

Keyrocks

  • Doug
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 451
  • Posts: 6258
  • Semantically Challenged
    • snews.ca
Re: FCKeditor and sNews1.6
« Reply #12 on: October 13, 2007, 10:27:02 PM »

I don't know if you guys came across this old topic on using PHP Integration for FCKEditor in sNews 1.4 or not... but much of what applied there would quite likely apply when using it with sNews 1.6. If you're having any problems... give it a look.  ;)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

dhn

  • Newbie
  • *
  • Karma: 0
  • Posts: 15
Re: FCKeditor and sNews1.6 Javascript functions
« Reply #13 on: October 13, 2007, 11:19:39 PM »

Hello again...

I got FCKeditor working in the enchanced MU version. But sadly I can't use the file, internal link, and image mod anymore because of the editor change.

I tried some things but I wasn't clever enough to figure out how i got it working in the new editor, can anyone tell me if it's possible to apply these mods or if its to difficult?



DHN

Note: FCKeditor is implemented as Javascript
« Last Edit: October 13, 2007, 11:21:14 PM by dhn »
Logged

3Pinter

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 61
    • Fromthemill.nl
Re: FCKeditor and sNews1.6
« Reply #14 on: October 14, 2007, 02:22:32 AM »

dhn,

What do you mean with:
- 'the file'
- internal link
- image mod.... ?

FCK is indeed implemented as JS, however this shouldn't be a problem since no big audience is viewing an administration site.
Pages: [1] 2