News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

How to create a WYSIWYG textbox alike SMF post forms?

Started by HecKel, November 13, 2011, 03:19:46 PM

Previous topic - Next topic

HecKel

Hi!


I am developing a small mod to my community which requires an area WYSIWYG like the SMF new topic/reply's screen. How can I do it? Does SMF has any function to automatize it?


Thanks in advance
Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

HecKel

Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

HecKel

Hey!

I am really stuck at this point, some help would be appreciated...
Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

Suki

if you want to use the editor you will have to call

heres an example:

<?php
require_once($sourcedir '/Subs-Editor.php');
// Needed for the WYSIWYG editor, we all love the WYSIWYG editor...
$modSettings['disable_wysiwyg'] = !empty($modSettings['disable_wysiwyg']) || empty($modSettings['enableBBC']);

$editorOptions = array( 
'id' => 'body'// the ID of the textarea, needed when you will colect the data from the editor
'value' => ''// empty or filled with a predifine text or variable or something
'width' => '90%',
);

create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];



then on your template file you echo the editor:

                  if ($context['show_bbc'])
                     echo '<div id="bbcBox_message"></div>';

                  if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
                     echo '<div id="smileyBox_message"></div>';
                           
                  echo template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');


basically thats the way to go, take a look a some of the mods that uses the editor to see a live example.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

HecKel

Great! Thanks!

I'll try it and then I'll let you know :)
Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

Advertisement: