vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO] Add WYSIWYG Editor to Your Modifications (https://vborg.vbsupport.ru/showthread.php?t=228693)

xman_79 12-20-2009 12:11 PM

not understand why you use

PHP Code:

define('GET_EDIT_TEMPLATES'true); 

The php file

PHP Code:

error_reporting(E_ALL & ~E_NOTICE);
define('THIS_SCRIPT''name_of_your_script');
define('CSRF_PROTECTION'true);

$phrasegroups = array('posting');

$specialtemplates = array('smiliecache','bbcodecache',);

$globaltemplates = array(
    
'newpost_disablesmiliesoption',
    
'newpost_usernamecode',
    
'editor_toolbar_on',
    
'editor_clientscript',
    
'editor_jsoptions_font',
    
'editor_jsoptions_size',
    
'editor_smilie',
    
'editor_smiliebox',
    
'editor_smiliebox_row',
    
'editor_smiliebox_straggler',
    
'editor_css',
    
'editor_smilie_category',
    
'editor_smilie_row',
    
'editor_toolbar_colors',
    
'editor_toolbar_fontname',
    
'editor_toolbar_fontsize',
    
'bbcode_code_printable',
    
'bbcode_html_printable',
    
'bbcode_php_printable',
    
'bbcode_quote_printable',
    
'bbcode_code',
    
'bbcode_html',
    
'bbcode_php',
    
'bbcode_quote',
    
'bbcode_video',
);

require_once(
DIR '/includes/functions_editor.php');

$editorid construct_edit_toolbar(''0'signature'11false);


$templater vB_Template::create('MY_EDITOR_TEMPLATE');
    
$templater->register('editorid'$editorid);
    
$templater->register('messagearea'$messagearea);
$myeditortemplate $templater->render(); 

I use the editor to about 10 hacks, I have no problem.

Mythotical 12-23-2009 06:27 AM

The part that I use above is sticking with code ethics basically, it saves on lines of code per file and does the same exact thing as this does:

PHP Code:

$globaltemplates = array( 
    
'newpost_disablesmiliesoption'
    
'newpost_usernamecode'
    
'editor_toolbar_on'
    
'editor_clientscript'
    
'editor_jsoptions_font'
    
'editor_jsoptions_size'
    
'editor_smilie'
    
'editor_smiliebox'
    
'editor_smiliebox_row'
    
'editor_smiliebox_straggler'
    
'editor_css'
    
'editor_smilie_category'
    
'editor_smilie_row'
    
'editor_toolbar_colors'
    
'editor_toolbar_fontname'
    
'editor_toolbar_fontsize'
    
'bbcode_code_printable'
    
'bbcode_html_printable'
    
'bbcode_php_printable'
    
'bbcode_quote_printable'
    
'bbcode_code'
    
'bbcode_html'
    
'bbcode_php'
    
'bbcode_quote'
    
'bbcode_video'
); 

Just one line of code instead of 10-15 lines to call all those templates.

In all honesty, you don't have to call these templates as you have done:
PHP Code:

    'bbcode_code_printable'
    
'bbcode_html_printable'
    
'bbcode_php_printable'
    
'bbcode_quote_printable'
    
'bbcode_code'
    
'bbcode_html'
    
'bbcode_php'
    
'bbcode_quote'
    
'bbcode_video'

From what I have learned is that each one of those templates is already cached and called when you use the editor.

MaryTheG(r)eek 12-24-2009 08:21 AM

1 Attachment(s)
Hello Steve,

I've problem including the editor in my mod. See the attached images to understand what I mean. The first one is without including "...GET_EDIT_TEMPLATES..." in my php file, the second is with this.

http://www.microhellas.com/dev4/auct...do=addedititem

I'm also getting that yellow triangle:
Code:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Date/Time: Thu, 24 Dec 2009 10:18:59 UTC
 
Message: Το 'vB_XHTML_Ready' has not been assigned
Line: 11
Character: 1
Code: 0
URI: http://www.microhellas.com/dev4/clie...ditor.js?v=400

Thank you in advance
Maria

PS- I found the solution

At the very top of the template,

After:
Code:

<![CDATA[
and Before:
Code:

<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
Must be:
Code:

{vb:stylevar htmldoctype}
But that dammit triangle still exists.

Merry Christmas Steve (and to all surfers of course).
Maria

Mythotical 12-24-2009 05:16 PM

Great to hear Maria.

MaryTheG(r)eek 12-26-2009 08:49 AM

1 Attachment(s)
Hello Steve,

In view mode the text loses some formatting (in my case bullets). See attachment 1 which is in edit mode. Bullet list has been saved correctly. Now the 2nd attachment. Even if the text coloring is ok, the bullet list appears as normal text lines.

The code that I've wrote:

PHP file
Code:

// Format Bodytext
$bodytext = $item["bodytext"];
$bodytext = convert_wysiwyg_html_to_bbcode($bodytext);
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$bodytext = $bbcode_parser->parse($bodytext, $post['allowsmilie']);

Template
Code:

<tr>
  <td colspan="4" class="blockrow" align="left" width="100%">
      {vb:raw bodytext}
  </td>
</tr>

Thank you
Maria

Mythotical 12-26-2009 05:07 PM

Thanks Maria, I will get it altered in the article.

mikey1991 02-04-2010 06:54 PM

Steve, I know you posted this article for vB3, or one was posted, I just cannot find it. Any help?

Mythotical 02-05-2010 01:04 AM

Quote:

Originally Posted by mikey1991 (Post 1974868)
Steve, I know you posted this article for vB3, or one was posted, I just cannot find it. Any help?

Here is the article, not written by me: Add Editor to Your Mods

mikey1991 02-05-2010 02:57 PM

Great, thanks alot steve, appreciate that.

Mythotical 02-15-2010 08:20 PM

Quote:

Originally Posted by mikey1991 (Post 1975442)
Great, thanks alot steve, appreciate that.

Your welcome.


All times are GMT. The time now is 07:27 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01894 seconds
  • Memory Usage 1,768KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete