1
hrac
koivi editor doesn't pass content
  • 2008/3/2 16:16

  • hrac

  • Quite a regular

  • Posts: 305

  • Since: 2002/7/15


Hello,

While developing a module I wanted to use koivi editor, I noticed that koivi editor didn't pass the content that I entered with Koivi editor. The following is the code I use.
What mistake I did in the code? Would you please help me?

Thanks

<?php
require('../../mainfile.php');
require(
XOOPS_ROOT_PATH.'/header.php');
include_once 
XOOPS_ROOT_PATH."/class/xoopsformloader.php";

$sample_form = new XoopsThemeForm('', 'tutorial_form', "index.php");
$sample_form->setExtra('enctype="multipart/form-data"');

include_once(
XOOPS_ROOT_PATH . '/class/xoopseditor/koivi/formwysiwygtextarea.php');
$editor = new XoopsFormWysiwygTextArea('Message', 'msg', $msg, '40%', '450px', '');
$sample_form->addElement($editor,false);
$submit = new XoopsFormButton('', 'submit', "submit", 'submit');
$sample_form->addElement($submit,false);
$sample_form->display();

if (isset(
$_POST['submit'])) {
    
$message=$_POST['msg'];
    echo 
'msg: '.$message;
}
require(
XOOPS_ROOT_PATH.'/footer.php');
?>

PS: This error was generated:

Warning: Invalid argument supplied for foreach() in file /class/xoopseditor/koivi/formwysiwygtextarea.php line 51

2
McDonald
Re: koivi editor doesn't pass content
  • 2008/3/2 22:39

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


Why don't you copy/paste some code from another module?
A lot of modules have a config array in xoops_version.php for adding an option to the Preferences so a webmaster can choose which editor to use.

Also a function needs to be created in /include/functions.php for all the editors.

Then in the submit form you can call this function.

If you download WF-Links you can see how this is done. WF-Links uses two config options in Preferences so the editor can be set for admins differently from that for users.