Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 07:42:19 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155551 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Module using WYSIWYG after WYSIWYG section  (Read 293 times)
LuuQ

Offline Offline

Posts: 96



WWW
« on: August 13, 2011, 03:25:19 PM »

Ok, after hours of searching and trying out different things, I don't have any more clue why this isn't working:

On a page, I have two sections. First, a WYSIWYG section, where I put in a page title and some text.
After that, I inserted a section of a module I have written myself, where I have a textfield which I want to edit also with a WYSIWYG editor.

The problem is, that the second WYSIWYG editor is not loaded onto the textfield.

In my module, the code to instantiate the WYSIWYG editor looks like this:

Code:
<?php
if(!isset($wysiwyg_editor_loaded)) {
$wysiwyg_editor_loaded=true;

if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
function show_wysiwyg_editor($name,$id,$content,$width,$height) {
echo '<textarea name="'.$name.'" id="'.$id.'" rows="10" cols="1" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
}
} else {
if (!isset($id_list)) {
$id_list = array();
}
array_push($id_list,'beschreibung');
require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
}
}
?>


Then I want to load the editor with the following:

Code:
<?php
     show_wysiwyg_editor
('astBeschreibung','beschreibung',$row['astBeschreibung'],'300px','300px');
?>


I have already done this with other modules and it worked just fine. I think it's because of the first section, where the WYSIWYG editor is loaded, that it doesn't want to work.
I made a print_r(); on the $id_list and there wasn't any "beschreibung" in the array.
So I took the array_push($id_list,'beschreibung'); out of the the if:

Code:
<?php
if(!isset($wysiwyg_editor_loaded)) {
$wysiwyg_editor_loaded=true;

if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
function show_wysiwyg_editor($name,$id,$content,$width,$height) {
echo '<textarea name="'.$name.'" id="'.$id.'" rows="10" cols="1" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
}
} else {
if (!isset($id_list)) {
$id_list = array();
}
array_push($id_list,'beschreibung');
require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
}
}
array_push($id_list,'beschreibung');
print_r($id_list);
?>

 and then the result of $id_list was the following:

Code:
Array( [0] => content56 [1] => beschreibung )

I think that's fine, but the second WYSIWYG editor still doesn't load.
There are no javascript errors. I'm currently using TinyMCE 3.393 and Websitebaker 2.8.1.

Anyone can help?

Thanks in advance.
Logged
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7973



WWW
« Reply #1 on: August 13, 2011, 06:24:05 PM »

Hello,

when you change the WYSIWYG-Editor to FCKEditor, did this work?

Matthias
Logged
LuuQ

Offline Offline

Posts: 96



WWW
« Reply #2 on: August 14, 2011, 12:05:10 PM »

Yes, it works with FCKeditor. But I don't like to use FCKeditor.

I figured out that this if also returns false:

Code:
<?php
   
if(!isset($wysiwyg_editor_loaded)) { } 
?>

I think it's because the first WYSIWYG section requires the include.php of TinyMCE and I can't require it another time because otherwise there's an error:

Code:
Fatal error: Cannot redeclare reverse_htmlentities() (previously declared in /modules/tiny_mce/include.php:30) in /modules/tiny_mce/include.php on line 33

So include.php won't be loaded with the updated $id_list, because its loaded before I push that array.
And I cannot move the require of the include.php because then the function show_wysiwyg_editor(); of the first WYSIWYG section isn't found anymore.

What can I do now?
Logged
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7973



WWW
« Reply #3 on: August 14, 2011, 12:20:32 PM »

Hallo,

Try version 3.394, maybe this solves this issue. If not the dev of this modul should adapt his modul, that it can be loaded in different sections. It shouldn't be to hard, as the core of WB supports this option.

Matthias
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!