Replacing the textboxarea in XOOPS is easier than you might believe and this little tutorial should help guide you in this.
There are two methods depending on whether the module uses XoopsFormClass or not.
The first example is replacing the XOOPS original Textboxarea (A module that does NOT use XoopsFormClass)
The first thing you need to do is setup the module to use the Spaw editor, without this you will not be able to use spaw and could save you countless hours trying to figure out why spaw is not working
Open up the file /modules/news/admin/storyform.inc.php and at roughly line 31 look for this:
Quote:
include XOOPS_ROOT_PATH."/include/xoopscodes.php";
And insert these lines underneath the above line:
Quote:
$spaw_root = XOOPS_ROOT_PATH . '/modules/spaw/';
include_once $spaw_root . 'spaw_control.class.php';
NB: These lines need to be executed as quickly as possible within the page, so try and get them as near to the top of the page as possible. But MUST be after any includes such as mainfile.php, admin_header.php, or cp_header.php. General rule would be to add after any 'includes' already there.
Next we need to replace the TextBoxArea it self, Look for the following at roughly line 88
Quote:
xoopsCodeTarea("bodytext", 60, 15, 2);
xoopsSmilies("bodytext");
And replace it with these lines:
Quote:
$sw = new SPAW_Wysiwyg( 'bodytext', $bodytext, 'en', 'full', 'default', '99%', '600px' );
$sw -> show();
You will notice that the first item in the function xoopsCodeTarea is 'bodytext', you will have to use the same item in the spaw function, but you will also have to include the item taken from the database. In this case $bodytext
Another example here is when using the spaw editor in a module that uses XoopsFormClass.
To replace a TextBoxArea with XoopsFormClass, you will have to look for these
XoopsFormDhtmlTextArea or
XoopsFormTextArea.
Lets just say that the news module had been updated to use XoopsForm class, the line you would be searching for to replace could look something like this:
Quote:
$sform -> addElement( new XoopsFormDhtmlTextArea( _AM_EXTEXT, 'bodytext', $bodytext, 15, 60 ), true );
You would have to replace this with:
Quote:
ob_start();
$sw = new SPAW_Wysiwyg( 'bodytext', $bodytext, 'en', 'full', 'default', '99%', '600px' );
$sw -> show();
$sform -> addElement( new XoopsFormLabel( _AM_EXTEXT, ob_get_contents() ) );
ob_end_clean();
Always use this when replacing a TextBoxArea in XoopsFormClass.
Hope this helps you