alfred
Administrator
Gepostet am:07.04.2010 14:46
#18
Aw:: Wie kann ich den Xoopseditor in meinem Modul laden?
07.04.2010 14:46 so, mal hier (anpassungsfähig)
<?php
include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mainfile.php';
include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
$xoopsOption['template_main'] = 'userpage_form.html';
include $GLOBALS['xoops']->path('header.php');
$myts = myTextSanitizer::getInstance();
$post='';
$title='';
$poster='';
if (isset($_POST['submit']))
{
if (empty($_POST['titel']) || empty($_POST['post']))
{
echo '<div class="errorMsg">';
echo 'Alle Felder müssen ausgefüllt sein!';
echo '</div>';
}
else
{
$poster=$xoopsUser->getVar('uname');
$titel=$myts->addslashes($_POST['titel']);
$post=$myts->addslashes($_POST['post']);
$query = "Insert into ".$xoopsDB->prefix("userpage_database")." (poster, titel, post) values ('$poster', '$titel', '$post' )";
$res=$xoopsDB->query($query);
if(!$res)
{
$message = "Fehler" . $query;
redirect_header('#', 0, $message);
}
else
{
$message = "Nachricht erfolgreich abgesendet";
redirect_header('index.php', 0, $message);
}
exit();
}
}
$editor_configs=array();
$editor_configs['name'] = 'post';
$editor_configs['value'] = $post;
$editor_configs['rows'] = 20;
$editor_configs['cols'] = 50;
$editor_configs['width'] = '100%';
$editor_configs['height'] = '400px';
$editor_configs['editor'] = ''; // Leer oder Name des Editors
$form = new XoopsThemeForm('Titel des Formulares', 'Name des Formulares', 'deinDateiname.php', 'post', true);
$form->addElement(new XoopsFormText('Titel', 'title', 15, 60, $myts->htmlSpecialChars($title)), true);
$form->addElement(new XoopsFormEditor('Caption', $editor_configs['name'], $editor_configs,'dhtmltextarea'));
$form->display();
include $GLOBALS['xoops']->path('footer.php');
?>