Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: [1] 2

Author Topic: [ADDON] Integrating FCK Editor (sNews 1.4)  (Read 10140 times)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
[ADDON] Integrating FCK Editor (sNews 1.4)
« on: September 08, 2006, 09:49:27 pm »

Preface:
Updated a bit on Sept. 10/06

This successful integration of FCKEditor with sNews began while looking for a solution to AgniZ's problem trying to use Javascript to get FCKEditor running with sNews. His problem is outlined here. I didn't have any luck with the JS Integration, so I took at look at the PHP Integration. What follows is a short version to get you started with PHP Integration, adding the FCKEditor Panel to the new_article and edit_article functions in snews.php. I MAY put a full tutorial on snews.ca if I decide to spend some time learning to 'streamline' FCKEditor. However... sNews 1.5 (RC version) is now out for testing to us all... and has enhanced features that may make this add-on less useful in the end.

I should note that I have no interest in using FCKEditor myself, as I am fairly comfortable with using HTML mark-up in-line while composing articles. I only offer these "tips" to help anyone else get started with FCKEditor... nothing more. If you choose to work with FCKEditor, you will need to figure it out pretty much on your own... so be ready for an adventure! Check out the official FCKEditor documentation for PHP Integration. Keep .txt logs of what you do while you fiddle and mod, so you can always back out of an unsuccessful move. The following assumes you've already downloaded and un-zipped FCKEditor.

Step 1:If you are uploading directly to your remote (host) server, upload the FCKeditor folder into the root of your website directory... the same location where your index.php and snews.php files are. If you are installing this within an offline (localhost) server, just copy and paste the folder into the sNews 1.4 site's root folder.

Before modding - backup your snews.php file!!

Step 2 - Modding snews.php: There are 5 textareas in snews.php, in function comment, contact, new_article, edit_article and edit_comment. The mod steps are essentially the same for each function, but I'll only deal with new_article and edit_article here to keep it short. So... open snews.php in a good code editor.

In function new_article - just under the first line, add:
Code: [Select]
include("FCKeditor/fckeditor.php"); // includes functions to display FCKEditor textarea.The above line needs to be inserted at the start of any function in which you choose to replace the default sNews textara. Now... in the same function, scroll down and find this line which creates the default sNews textarea:
Code: [Select]
<p><textarea name="text" class="text"><? echo $_SESSION['temp']['text']; ?></textarea>and replace it with the following lines:
Code: [Select]
<?
echo "<p>";
$oFCKeditor = new FCKeditor('text') ;
$oFCKeditor->BasePath = 'FCKeditor/';
$oFCKeditor->Value = $_SESSION['temp']['text'];
$oFCKeditor->Create() ;
echo "</p>";
?>
In function edit_article - just under the first line, add the same include line we added to the new_article function above. Then scroll down and find this line which (again) creates the default sNews textarea... in the Edit Article Admin Panel:
Code: [Select]
<p><textarea name="text" class="text"><? echo stripslashes($text); ?></textarea></p>and replace it with the following lines:
Code: [Select]
<?
echo "<p>";
$oFCKeditor = new FCKeditor('text') ;
$oFCKeditor->BasePath = 'FCKeditor/';
$oFCKeditor->Value = stripslashes($text); // includes the article text to be edited in the textarea
$oFCKeditor->Create() ;
echo "</p>";
?>
Step 3: Create a new folder in the root of your site called UserFiles. When you create new folders using the FCKEditor Image upload feature, it will put the new folders within this new folder.

Step 4 - PHP Activation
FCKEditor has 'engine' files to run it in several different code-modes. Since we are using the PHP Integration... in the fckconfig.js file... lines 134 and 135...
we need to change the code language settings from 'asp' to 'php'. This enables the php system for file browsing and uploading. So change the lines on the ends from:
Code: [Select]
var _FileBrowserLanguage    = 'asp' ;
var _QuickUploadLanguage    = 'asp' ;
so they look like this:
Code: [Select]
var _FileBrowserLanguage    = 'php' ;
var _QuickUploadLanguage    = 'php' ;
Then, you need to open the config.php file in the FCKeditor/editor/filemanager/upload/php folder.
- Scroll down to line 24... to $Config['Enabled'] = false ; and change false to true.

Then you need to do the same in the config.php file in the
FCKeditor/editor/filemanager/browser/default/connections/php folder, on line 24.

And... believe it or not... that's all you need to do to get the FCKEditor package functioning in your sNews 1.4 site. The real fun starts once you have it working... lots to learn... to figure out... etc. Documentation on how it works and how to use it is, in my view, a bit sparce. But there are sample files and some documentation files within the FCKEditor package for you to browse and ponder over. Remember, using add-ons like this requires experimentation and patience, as you must learn by doing. :)
« Last Edit: October 13, 2007, 10:22:00 pm by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

AgniZ

  • Newbie
  • *
  • Karma: 0
  • Posts: 40
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #1 on: September 08, 2006, 11:04:19 pm »

Great ! I will try it then let you know very very soon (I hope!)
Thanks for your so kind support.

AgniZ
BRAZIL
Logged

AgniZ

  • Newbie
  • *
  • Karma: 0
  • Posts: 40
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #2 on: September 09, 2006, 01:52:45 pm »

Keyrocks rocks ! It works! Amazing how simple the process was... thank you very much! It is a powerful editor... ok, you rarely will use half of all available features but anyway it is a rich tool. I am very satisfied...and relaxed ! The most important to me is the same site is viewed at Firefox and IE what did not run with TinyMCe.

Well, As the problems never ends up: the built in function of image upload is not working with me...what about at your side? I canīt upload any image neither create a new folde (I mean using the IMG uploader in the FCKeditor).

AgniZ
Brazil
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #3 on: September 09, 2006, 03:40:53 pm »

Quote from: AgniZ
Keyrocks rocks ! It works! Amazing how simple the process was...
Well,  the built in function of image upload is not working with me...what about at your side? I canīt upload any image neither create a new folder (I mean using the IMG uploader in the FCKeditor).
(The solution has been added to the first post in this topic string, Sept. 10/06).
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

AgniZ

  • Newbie
  • *
  • Karma: 0
  • Posts: 40
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #4 on: September 09, 2006, 07:09:30 pm »

OK!! great (again!)... after some trial and errors...it works! Once again, thank you very much! My website is better every day! Thanks Solucija !!

*** oops, editing the original message: right now I see that it did not work with IE... the same happened there at your side keyrocks?

I got the following messages when editing or creating a new article:

Error: 'FCKConfig.ContextMenu.length' is null or not an object
** this only happens with IE... in Firefox is working nicely ! God bless Micro$oft !

AgniZ
Brazil
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #5 on: September 09, 2006, 11:46:26 pm »

I've been doing all my testing on this in both IE6 and FF on an XP Home machine, and I have not experienced this problem.
(The rest has been removed and added to the first post in this topic string, Sept. 10/06).
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Tomasz Nawrat

  • Newbie
  • *
  • Karma: -1
  • Posts: 11
    • http://www.tvc.com.pl
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #6 on: October 12, 2006, 04:50:55 am »

I just finnished. This is absolutely fantastic REVISED VERSION of sNews
I mean FCKeditor with sNews is excellent

keyrocks,  Thank you for this! :)

tnwirtu
Logged

comez

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #7 on: October 15, 2006, 02:26:49 am »

this which line ?
Code: [Select]
function new_article
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #8 on: October 15, 2006, 04:55:53 pm »

Quote from: comez
this which line ?
Code: [Select]
function new_article
Welcome to our sNews Community, comez. The function new_article and function edit_article are the first lines of both functions located (with all the other 'engine' functions) in the snews.php file. You need a good code editor program that has a search function in it so you can search for those exact lines... this makes it easier for you to find the functions since the snews.php file (in sNews 1.4) has close to 2,000 lines of code in it. So - just search for those 2 functions using their names as noted above, and you'll find them.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

keyone

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #9 on: November 04, 2006, 01:58:42 pm »

do these instructions work for the current release of snews (15R3)?
Thanks!
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #10 on: November 04, 2006, 03:14:42 pm »

The simple answer... no. Integration would require a different approach in 1.5 as textarea functionality is controlled much differently in 1.5 and includes several function buttons that were not available in 1.4. In my view, these function buttons make the use of other textarea enhancements (like FCKEditor and Tiny MCE) unecessary. Sevir has worked out integration for 1.5 here if you want to give it a try - http://www.solucija.com/forum/viewtopic.php?pid=16279#p16279
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

pepe

  • Newbie
  • *
  • Karma: 0
  • Posts: 7
    • http://phpwcms-templates.de
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #11 on: November 04, 2006, 06:09:02 pm »

Quote from: keyrocks
...
In my view, these function buttons make the use of other textarea enhancements (like FCKEditor and Tiny MCE) unecessary.
I don't share your opinion, keyrocks!
If you will have a look into my little sNews-sandbox : http://snews.peperkorn-online.de/snews-/ you can see, that i have included some images and with FCKeditor-features i managed the thickbox ability of these pictures.

An other great plus of using FCKeditor is the possibility, to add your own special STYLES to your text, only with a mouseclick!
I've made a little tutorial inside another CMS [ phpWCMS - German only :( ], where you can see, what i mean:

http://peperkorn-online.de/fckeditor.phtml

My sandbox is in sNews v1.4 - OK ..... but nevertheless... FCKeditor is a MUST HAVE for me in all my scripts!
Logged
mfG pepe

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #12 on: November 05, 2006, 03:39:23 am »

Quote from: pepe
Quote from: keyrocks
...
In my view, these function buttons make the use of other textarea enhancements (like FCKEditor and Tiny MCE) unecessary.
I don't share your opinion, keyrocks!
My sandbox is in sNews v1.4 - OK ..... but nevertheless... FCKeditor is a MUST HAVE for me in all my scripts!
Hey.. Pepe... Like I said... it's just MY view... no need to get defensive... each to his own. By all means, use FCKEditor if you need it. I don't so I don't. Again... each to his own. :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

vooyeck

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #13 on: February 16, 2007, 12:14:56 pm »

Hello All :)

Quote from: keyrocks
In function new_article - just under the first line, add:
I'm sorry but in new version 1.5.31, can't find this function (using Notepad2 with search :D )

regards
Voo Yeck
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
[ADDON] Integrating FCK Editor (sNews 1.4)
« Reply #14 on: February 16, 2007, 03:20:17 pm »

Quote from: vooyeck
Hello All :)
Quote from: keyrocks
In function new_article - just under the first line, add:
I'm sorry but in new version 1.5.31, can't find this function (using Notepad2 with search :D )
regards
Voo Yeck
Voo... as you will see... this topic is about using FCKEditor with sNews 1.4... [ADDON] Integrating FCK Editor (sNews 1.4). sNews 1.5.31 has its own editor function buttons.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU
Pages: [1] 2