$editorOptions not load

Started by Jotade29, April 21, 2025, 10:44:34 PM

Previous topic - Next topic

Jotade29

V: 2.0.19.
I'm trying to create a text box that displays the emoticons and bbcodes, just like the ones that appear when I post a topic or make a reply...

For this, I have these files properly linked.

Test.php
Global...
require_once($sourcedir . '/Subs-Editor.php');
$editorOptions = array(
        'id' => 'draft_body',
        'value' => '',
        'form' => 'post_draft',
        'labels' => array(
            'post_button' => 'TEST',
        ),
        'rows' => 12,
        'cols' => 60,
        'width' => '100%',
        'height' => '250px',
        'bbc' => true,
        'smileys' => true,
        'disable_smiley_box' => false,
        'preview_type' => 0,
    );
    create_control_richedit($editorOptions);
    $context['post_box_name'] = $editorOptions['id'];

Test.template
Global...
echo '
<form action="', $scripturl, '?action=draft" method="post" accept-charset="UTF-8" id="post_draft" name="post_draft">
<div class="windowbg">
<h2 class="catbg">Crear Borrador</h2>
<div class="content">
<p><strong>Título:</strong><br>
<input type="text" name="draft_title" size="80" value=""></p>

<p><strong>Mensaje:</strong><br>';
               
template_control_richedit($context['post_box_name']);

echo '
</p>
<p><input type="submit" name="save_draft" value="TEST" class="button_submit"></p>
</div>
</div>
</form>

The result of the code is that it creates the text box correctly, but the emoticons and b-codes don't appear. What's wrong with that?

Thnxx!!
Quote from: Diego Andrés on August 12, 2023, 02:20:18 AMI'm afraid convincing Jotade to upgrade to SMF 2.1 will require bigger effort than your work sanitizing Unicode characters  :laugh:

All Colours Sam

template_control_richedit() will need another 2 params for the boxes to appear:

template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message')
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Advertisement: