Joined: Dec 03, 2005 Posts: 148 Location: West Midlands. United Kingdom
Posted:
Sat Nov 19, 2011 7:41 am
Hi All
I have a Module that I have done that uses a text area, it works fine, then I thought, instead of using the text area can I include the FCKeditor, I have looked through the forums on to include the FCKeditor in a Module.
Is there a read me file I can read that will explain on how to include the FCKeditor within a New Module.
The first parameter as you can see if the form field name.
The second parameter is usually empty (though I do sometimes use it for hinting purposes) like this
Code:
wysiwyg_textarea('fieldname', 'Please type your data here', 'Basic', '50', '10');
You can also use it for editing purposes. Lets say you have pulled data from the DB and the text is held in $edit_me_txt you can do;
The third parameter is the toolbar, Basic, NukeUser or NukeAdmin I think are the pre-configured toolbars.
The remaining two are failr self explanatory; the row and column sizes you would use in a normal textarea field.
Joined: Aug 30, 2005 Posts: 3186 Location: near Albany NY
Posted:
Sat Nov 19, 2011 10:07 am
I'm not sure there is a readme on this. Start by taking a look at the wysiwyg_editor function in mainfile. You will see the parameters that are needed and the fact that it includes a file from the /includes directory. Trace that back and you will see that in turn a specific file for php4 or php5 is included to actually load the editor.
With that background, take a look at one of the current modules and how the editor is used. For instance /modules/news/admin/index.php does this to let you enter the text for a news story:
The first parameter is what the field on the form will be named. The second is the variable being passed in ... it could be blank in the case where you are entering data from scratch. The third parameter determines the privileges you will have inside the text area. The options that I know of are 'Nukeuser' and 'PHPNukeAdmin'. You can actually delve into the fckconfig.js file in the includes directory to see that there are different toolbars set depending on the value of this third parameter. The 4th and 5th parameters are the number of columns and rows.
Note that if you haven't enabled wysiwyg editing in the rnconfig file then the mainfile function will just give you a plain text area.
Joined: Dec 03, 2005 Posts: 148 Location: West Midlands. United Kingdom
Posted:
Sat Nov 19, 2011 2:17 pm
Hi All
Guardian2003
You have answered all my questions regarding the wysiwyg_textarea
Thank you.
fkelly
While I was waiting for a reply, I had a look at the Submit News Module file and what you told me to look for in the background, now with that and what Guardian2003 explained, it was made easier to follow.
From the nukeWYSIWYG readme.txt file (please note steps 6 and 7 - there are 2 approaches, depending on how the module, block, admin function works):
Code:
INSTALLATION
Before installing, consider upgrading to RavenNuke(tm) (http://ravenphpscripts.com),
which has nukeWYSIWYG (tm) already incorporated, along with thousands of additional
features, improvements and security.
1. Security settings, in the form of custom toolbar settings ("toolbar sets"),
are defined in includes/fckeditor/fckconfig.js. Several are used with
nukeWYSIWYG (tm), including PHPNukeAdmin, NukeUser, and PHPNuke. By modifying or
creating additional toolsets in includes/fckeditor/fckconfig.js, you can
flexibly define access to different functions in FCKeditor.
2. Copy the contents of includes/fckeditor and includes/kses to your Nuke server.
3. Modify (if not already modified) mainfile.php to replace function check_html
and add function wysiwyg_textarea as shown in mainfile.txt
4. Modify (if not already modified) config.php to replace the $AllowableHTML
assignment as shown in config.txt.
NOTE: To disable the editor, simply set $advanced_editor = 0; in config.php
NOTE: To override the default folder for uploading files through the
FCKeditor filemanager, change the following in config.php (or rnconfig
if you use RavenNuke), and set $uploadpath to your desired location:
// To override the default uploads/ folder used for storing files uploaded
// through nukeWYSIWYG (tm) via FCKeditor's filemanager. It should include the
// full path from the root.
$uploadpath = '';
5. For Linux / Apache users: In order to upload images and flash files on
administrative functions, the permissions for uploads/file, uploads/flash,
uploads/image and uploads/media folders must either be set to 777, or the
Apache user must own these folders.
If you have addons / modules that do not already use nukeWYSIWYG (tm), you can complete the following:
6. For the standard "display-as-you-go" approach, replace textarea HTML tags in
modules and admin scripts with a PHP call to function wysiwyg_textarea with 5
arguments: textarea name, textarea value, the toolbar set name, textarea
columns and textarea rows. For example, in modules/Submit_News/index.php:
If there is a value between the <textarea> and </textarea>, tags, that should
be specified as the second argument in the wysiwyg_textarea function call.
The 3rd argument defines the toolbar set, which controls which functions are
available to the user. Since these functions can present security risks,
this should be chosen carefully. By default, the most limited toolset bar
will be chosen. In admin functions, you may choose to use PHPNukeAdmin which
loads all FCKeditor functions. The NukeUser toolbar set is more limited,
more secure and loads faster.
The textarea columns and rows are used in the event the WYSIWYG editor is
turned off. Rows are used to control the height of the text editor when the
WYSIWYG editor is on.
NOTE: The name of the first argument cannot contain reserved HTML tags, e.g.
description contains SCRIPT. This requires that the fields be renamed.
7. For a template / "build, then display" approach, replace the textarea HTML
with a similar PHP function call, wysiwyg_textarea_html. For example, from
My_eGallery:
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum