Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> FCKeditor/WYSIWYG Issues
Author Message
scorpious
Worker
Worker



Joined: Dec 03, 2005
Posts: 153

PostPosted: Sat Nov 19, 2011 7:41 am Reply with quote

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.

Cheers

Scorp
 
View user's profile Send private message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Sat Nov 19, 2011 10:00 am Reply with quote

It is actually pretty simple when you know how.
Instead of using
Code:


<textarea cols="50" rows="10" name="somefield"></textarea>

you just use
Code:


wysiwyg_textarea('somefield', '', 'Basic', '50', '10');

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;
Code:
wysiwyg_textarea('fieldname', $edit_me_txt, 'Basic', '50', '10');


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.
 
View user's profile Send private message Send e-mail
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Sat Nov 19, 2011 10:07 am Reply with quote

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:

Code:
   echo '<br /><br /><span class="thick">'._STORYTEXT.'</span><br />';

   wysiwyg_textarea('hometext', $hometext, 'PHPNukeAdmin', 50, 12);


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.
 
View user's profile Send private message Visit poster's website
scorpious







PostPosted: Sat Nov 19, 2011 2:17 pm Reply with quote

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.

Cheers to both of you

Scorp
 
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6437

PostPosted: Tue Nov 22, 2011 12:19 pm Reply with quote

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:

   echo "<br><br>"
        ."<b>"._STORYTEXT.":</b> ("._HTMLISFINE.")<br>
        ."<textarea cols=\"50\" rows=\"12\" name=\"story\"></textarea><br>";

   becomes:
   
   echo "<br><br>"
        ."<b>"._STORYTEXT.":</b> ("._HTMLISFINE.")<br>";
#   ."<textarea cols=\"50\" rows=\"12\" name=\"story\"></textarea><br>"
   wysiwyg_textarea("story", "", "NukeUser", "50", "12");

   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:

      $out .=
      '<center><p align="center"><form action="'.$baseurl.'" method="POST">'
      .'<input type="hidden" name="do" value="Post">'
      .'<font class="'.$font['title'].'">'._GALNAME.'</font>&nbsp;<b>'.$userdata[1].'</b>'
             .'<input type="hidden" name="gname" value="'.$userdata[1].'">'
             .'<input type="hidden" name="member" value="1"><br>'
      .'<font class="'.$font['title'].'">'._GALCOMMENT.'</font><br>'
      . '<textarea wrap="virtual" cols="40" rows="8" name="comment" type="text" maxlength="70"></textarea><br>'
       $out .= '<input class="textbox" type="hidden" name="pid" value="'.$pid.'">&nbsp;'
        .'<input type="submit" value="Envoyer">'
      .'</form>'
      .'<font class="option">'._GALNOTE.'</font></p></center>';

   becomes:
      $out .=
      '<center><p align="center"><form action="'.$baseurl.'" method="POST">'
      .'<input type="hidden" name="do" value="Post">'
      .'<font class="'.$font['title'].'">'._GALNAME.'</font>&nbsp;<b>'.$userdata[1].'</b>'
             .'<input type="hidden" name="gname" value="'.$userdata[1].'">'
             .'<input type="hidden" name="member" value="1"><br>'
      .'<font class="'.$font['title'].'">'._GALCOMMENT.'</font><br>';
      $out .= wysiwyg_textarea_html("comment", "", "NukeUser", "40", "8");
#      . '<textarea wrap="virtual" cols="40" rows="8" name="comment" type="text" maxlength="70"></textarea><br>'
       $out .= '<input class="textbox" type="hidden" name="pid" value="'.$pid.'">&nbsp;'
        .'<input type="submit" value="Envoyer">'
      .'</form>'
      .'<font class="option">'._GALNOTE.'</font></p></center>';

_________________
I search, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> FCKeditor/WYSIWYG Issues

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©