New editor tools module for Phorum 5.1+
Posted by Maurice Makaay
|
Re: New editor tools module for Phorum 5.1+ July 01, 2008 04:50AM |
Registered: 22 years ago Posts: 174 |
tried from different computers and the same tried yesterday... everything running fine.
I think problem is that I had installed and enabled the YahooUI JS Compressor (but not Java installed), so I was getting those errors. Disabled it and everything running fine again, probably had templates cached as everything now works as expected.
Thanks and sorry for the inconvenience!
I think problem is that I had installed and enabled the YahooUI JS Compressor (but not Java installed), so I was getting those errors. Disabled it and everything running fine again, probably had templates cached as everything now works as expected.
Thanks and sorry for the inconvenience!
|
Re: New editor tools module for Phorum 5.1+ July 01, 2008 05:01AM |
Admin Registered: 22 years ago Posts: 8,532 |
No problem and thanks for your update. The compressor should fallback gracefully if java cannot be found, but maybe there was some error message output in your page or so. Glad to hear that it's solved by disabling the compressor.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: New editor tools module for Phorum 5.1+ September 30, 2008 05:57PM |
Registered: 20 years ago Posts: 43 |
Hi all,
I tried to add another button to the editor menu using a module as described in the readme file.
However, I get a "Warning: Cannot modify header information - headers already sent by (output started at /.../mods/offtopic/offtopic.php:7)".
Here is the content of file offtopic.php:
[code="php" number]
<?php
if(!defined("PHORUM")) return;
function phorum_mod_offtopic_editor_tool_plugin()
{
?>
<script type="text/javascript">
function editor_tools_handle_offtopic() {
editor_tools_add_tags('[ot]', '[/ot]');
editor_tools_focus_textarea();
}
</script>
<?php
editor_tools_register_tool(
'offtopic', // Tool id
'markiert Text als nicht zum Thema gehörend', // Tool description
'./mods/offtopic/icon.gif', // Tool button icon
'editor_tools_handle_offtopic()', // Javascript action on click
22, // Tool icon width
20 // Tool icon height
);
}
?>
[/code]
I followed the readme file very closely. The mod works (as does my additional bbcode for turning [ot]-[/ot]-formatted strings into greyish text) but I'd like to get rid of the warnings.
Thanks a lot in advance,
Marian
I tried to add another button to the editor menu using a module as described in the readme file.
However, I get a "Warning: Cannot modify header information - headers already sent by (output started at /.../mods/offtopic/offtopic.php:7)".
Here is the content of file offtopic.php:
[code="php" number]
<?php
if(!defined("PHORUM")) return;
function phorum_mod_offtopic_editor_tool_plugin()
{
?>
<script type="text/javascript">
function editor_tools_handle_offtopic() {
editor_tools_add_tags('[ot]', '[/ot]');
editor_tools_focus_textarea();
}
</script>
<?php
editor_tools_register_tool(
'offtopic', // Tool id
'markiert Text als nicht zum Thema gehörend', // Tool description
'./mods/offtopic/icon.gif', // Tool button icon
'editor_tools_handle_offtopic()', // Javascript action on click
22, // Tool icon width
20 // Tool icon height
);
}
?>
[/code]
I followed the readme file very closely. The mod works (as does my additional bbcode for turning [ot]-[/ot]-formatted strings into greyish text) but I'd like to get rid of the warnings.
Thanks a lot in advance,
Marian
|
Re: New editor tools module for Phorum 5.1+ September 30, 2008 06:03PM |
Admin Registered: 22 years ago Posts: 8,532 |
You'll need to wrap that javascript code a bit. Here's an example of how you can do this:
[code="php"]
function phorum_mod_offtopic_editor_tool_plugin()
{
ob_start(); ?>
<script type="text/javascript">
function editor_tools_handle_offtopic() {
editor_tools_add_tags('[ot]', '[/ot]');
editor_tools_focus_textarea();
}
</script>
<?php
$PHORUM['DATA']['HEAD_TAGS'] .= ob_get_contents();
ob_end_clean();
editor_tools_register_tool(..etc...
[/code]
This will push the javascript code to the {HEAD_TAGS} template variable, which is loaded in the <head> section of the page by default.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
[code="php"]
function phorum_mod_offtopic_editor_tool_plugin()
{
ob_start(); ?>
<script type="text/javascript">
function editor_tools_handle_offtopic() {
editor_tools_add_tags('[ot]', '[/ot]');
editor_tools_focus_textarea();
}
</script>
<?php
$PHORUM['DATA']['HEAD_TAGS'] .= ob_get_contents();
ob_end_clean();
editor_tools_register_tool(..etc...
[/code]
This will push the javascript code to the {HEAD_TAGS} template variable, which is loaded in the <head> section of the page by default.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: New editor tools module for Phorum 5.1+ September 30, 2008 06:22PM |
Registered: 20 years ago Posts: 43 |
Hmm, this was partly successful. It solved the warnings issue, but now a click on the button does nothing.
Once I click on the button Firebug reports an error saying "editor_tools_handle_offtopic is not defined".
Before that, I had a warning and a working button ... :-)
Any ideas?
Cheers,
Marian
Once I click on the button Firebug reports an error saying "editor_tools_handle_offtopic is not defined".
Before that, I had a warning and a working button ... :-)
Any ideas?
Cheers,
Marian
|
Re: New editor tools module for Phorum 5.1+ October 01, 2008 01:23AM |
Admin Registered: 22 years ago Posts: 8,532 |
Oh sorry, I forgot something there.
$PHORUM is not global there. Start out your function by globalizing that variable:
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
$PHORUM is not global there. Start out your function by globalizing that variable:
function phorum_mod_offtopic_editor_tool_plugin()
{
global $PHORUM;
ob_start(); ?>
....etc....
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: New editor tools module for Phorum 5.1+ October 01, 2008 06:19AM |
Registered: 20 years ago Posts: 43 |
|
Re: New editor tools module for Phorum 5.1+ November 20, 2008 02:44AM |
Registered: 17 years ago Posts: 7 |
|
Re: New editor tools module for Phorum 5.1+ November 20, 2008 02:47AM |
Admin Registered: 24 years ago Posts: 9,240 |
|
Re: New editor tools module for Phorum 5.1+ November 20, 2008 03:15AM |
Registered: 17 years ago Posts: 7 |
Sorry, only registered users may post in this forum.


