Icy Phoenix


Documentation And How To - BBCODE - How To Add Icy Phoenix BBCode Parsing To MODS Or Other Pages



DWho [ Tue 15 Jul, 2008 00:39 ]
Post subject: BBCODE - How To Add Icy Phoenix BBCode Parsing To MODS Or Other Pages
hi

I have installed a mod that leaves a comment for a member but it has standard phpbb bbcode and I would like to make available the bbcode that is in the rest of the site..

I have added this to the php file
Code: [Hide] [Select]
// BBCBMG - BEGIN
include_once($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_bbcb_mg.' . $phpEx);
include($phpbb_root_path . 'includes/bbcb_mg.' . $phpEx);
$template->assign_var_from_handle('BBCB_MG', 'bbcb_mg');
// BBCBMG - END
// BBCBMG SMILEYS - BEGIN
generate_smilies('inline');
include($phpbb_root_path . 'includes/bbcb_smileys_mg.' . $phpEx);
$template->assign_var_from_handle('BBCB_SMILEYS_MG', 'bbcb_smileys_mg');
// BBCBMG SMILEYS - END


and this to the tpl file
Code: [Hide] [Select]
<tr align="center" valign="middle">
<td class="row2" valign="top">
{BBCB_MG}
<textarea name="message" rows="15" cols="35" wrap="virtual" style="width:98%" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea>
</td>


and stripped all the phpbb bbcode from the tlp file but sadly no bbcode is showing in the posting box....

I have spent some time looking throught the code to see what I have missed and searched here but cannot find anything....

any help would be greatly appreciated....

Thanks

:mrgreen: :mrgreen:


Lopalong [ Tue 15 Jul, 2008 01:54 ]
Post subject: Re: Bbcode
Can you make the unmodified MOD available in a .zip file, or at least the name of it and a url for where to download it from? 8)


DWho [ Tue 15 Jul, 2008 10:23 ]
Post subject: Re: Bbcode
yeah sure ... download url is here mpsmod

:mrgreen: :mrgreen:


Lopalong [ Thu 17 Jul, 2008 01:14 ]
Post subject: Re: Bbcode
Mate, I've been busy for the last couple of days :(

Have you gone any further with this before I attempt to see what the problem could be? Not to say that I can actually fix it either. ;)


DWho [ Thu 17 Jul, 2008 09:59 ]
Post subject: Re: Bbcode
I am going to have a look today as I have been busy the last couple of days....

If I get anywhere I post my results...

Thanks for taking the time out...

:mrgreen:


Mighty Gorgon [ Thu 17 Jul, 2008 11:13 ]
Post subject: Re: Bbcode
Some answers are in bbcode.php:

Code: [Hide] [Select]
=================
Includes
=================

include($phpbb_root_path . 'includes/bbcode.' . $phpEx);

=================
Globals
=================

global $bbcode;

=================
BBCode Parsing
=================

$text = $bbcode->parse($text, $bbcode_uid);

=================
BBCode Conditions
=================

$bbcode->allow_html = ($userdata['user_allowhtml'] && $board_config['allow_html']) ? true : false;
$bbcode->allow_bbcode = ($userdata['user_allowbbcode'] && $board_config['allow_bbcode']) ? true : false;
$bbcode->allow_smilies = ($userdata['user_allowsmile'] && $board_config['allow_smilies']) ? true : false;

=================

$html_on = ($userdata['user_allowhtml'] && $board_config['allow_html']) ? 1 : 0 ;
$bbcode_on = ($userdata['user_allowbbcode'] && $board_config['allow_bbcode']) ? 1 : 0 ;
$smilies_on = ($userdata['user_allowsmile'] && $board_config['allow_smilies']) ? 1 : 0 ;

$bbcode->allow_html = $html_on;
$bbcode->allow_bbcode = $bbcode_on;
$bbcode->allow_smilies = $smilies_on;

=================

$bbcode->allow_html = ($board_config['allow_html'] ? $board_config['allow_html'] : false);
$bbcode->allow_bbcode = ($board_config['allow_bbcode'] ? $board_config['allow_bbcode'] : false);
$bbcode->allow_smilies = ($board_config['allow_smilies'] ? $board_config['allow_smilies'] : false);

=================

$bbcode->allow_html = $board_config['allow_html'];
$bbcode->allow_bbcode = $board_config['allow_bbcode'];
$bbcode->allow_smilies = $board_config['allow_smilies'];

=================

$bbcode->allow_html = (($board_config['allow_html'] && $row['enable_bbcode']) ? true : false);
$bbcode->allow_bbcode = (($board_config['allow_bbcode'] && $row['enable_bbcode']) ? true : false);
$bbcode->allow_smilies = (($board_config['allow_smilies'] && $row['enable_smilies']) ? true : false);

=================

$bbcode->allow_html = ($board_config['allow_html'] && $postrow[$i]['enable_bbcode'] ? true : false);
$bbcode->allow_bbcode = ($board_config['allow_bbcode'] && $postrow[$i]['enable_bbcode'] ? true : false);
$bbcode->allow_smilies = ($board_config['allow_smilies'] && $postrow[$i]['enable_smilies'] ? true : false);

=================

$bbcode->allow_smilies = ($board_config['allow_smilies'] ? $board_config['allow_smilies'] : false);
$bbcode->allow_bbcode = ($board_config['allow_bbcode'] ? $board_config['allow_bbcode'] : false);
//$bbcode->allow_bbcode = ($bbcode_uid != '' ? $board_config['allow_bbcode'] : false);
=================


  • You need to remove old parsing functions
  • You need to include bbcode.php
  • You need to declare $bbcode as global if used within a function or a class
  • You need to setup vars for bbcodes, html and smileys
  • You need to parse the message


How to do that? Use the codes provided above... compare with some other files which parses BBCode to fully understand. :wink:

Renaming and moving to docs.


DWho [ Thu 07 Aug, 2008 10:31 ]
Post subject: Re: How To Add Icy Phoenix BBCode Parsing To MODS Or Other P
Well after spending nearly 3 weeks on this I dropped the idea...

it is probably quite simple to incorporate but I have to guess where the code might go as I have no before and after working examples...

I will have another attempt in the future..

:mrgreen: :mrgreen:


Lopalong [ Fri 08 Aug, 2008 01:39 ]
Post subject: Re: How To Add Icy Phoenix BBCode Parsing To MODS Or Other P
I'm not sure to what extent you need in the way of examples, but here's the old code that MODS use, and the new code that IP uses. ;)

Code: [Hide] [Select]
OLD:

$preview_announcement = $new['announcement_text_draft'];

$preview_announcement_uid = make_bbcode_uid();
$preview_announcement = bbencode_first_pass( $preview_announcement, $preview_announcement_uid );
$preview_announcement = bbencode_second_pass ( $preview_announcement, $preview_announcement_uid );
$preview_announcement = smilies_pass($preview_announcement, './../');
$preview_announcement = str_replace("n", "n<br />n", $preview_announcement);

#######

NEW: (Just one line that parses the bbCode to the page.)

$preview_announcement = $bbcode->parse ($new['announcement_text_draft']);

#######


NOTE: That the new "announcement_text_draft" is now encapsulated. ;-)

So this would be the most important line for parsing the code. $bbcode->parse ($new['announcement_text_draft']);


You could also download the modified ACP_Announcement_Center from icythemes.com as it's only about 3-4 pages, and strip the Db queries and anything else that you don't need out of it. :P

If you need to compare it, then search phpBB customisations for "Announcement" and that should bring up the old version.


Best of Luck! :mryellow:


Mighty Gorgon [ Mon 11 Aug, 2008 02:25 ]
Post subject: Re: How To Add Icy Phoenix BBCode Parsing To MODS Or Other P
That is correct... but remember you should make sure that bbcode.php has been correctly included and $bbcode defined as global if using that code within functions or classes.

This is the code that may be used:
  • For inclusion:
    Code: [Hide] [Select]
    @include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);

  • To declare var as global where needed:
    Code: [Hide] [Select]
    global $bbcode;


Plus you may want to decide what to parse or not...
Code: [Hide] [Select]
$bbcode->allow_html = false;
$bbcode->allow_bbcode = true;
$bbcode->allow_smilies = true;


Other examples on top of bbcode.php
Code: [Hide] [Select]
=================
Includes
=================

include($phpbb_root_path . 'includes/bbcode.' . $phpEx);

=================
Globals
=================

global $bbcode;

=================
BBCode Parsing
=================

$text = $bbcode->parse($text, $bbcode_uid);

=================
BBCode Conditions
=================

$bbcode->allow_html = ($userdata['user_allowhtml'] && $board_config['allow_html']) ? true : false;
$bbcode->allow_bbcode = ($userdata['user_allowbbcode'] && $board_config['allow_bbcode']) ? true : false;
$bbcode->allow_smilies = ($userdata['user_allowsmile'] && $board_config['allow_smilies']) ? true : false;

=================

$html_on = ($userdata['user_allowhtml'] && $board_config['allow_html']) ? 1 : 0 ;
$bbcode_on = ($userdata['user_allowbbcode'] && $board_config['allow_bbcode']) ? 1 : 0 ;
$smilies_on = ($userdata['user_allowsmile'] && $board_config['allow_smilies']) ? 1 : 0 ;

$bbcode->allow_html = $html_on;
$bbcode->allow_bbcode = $bbcode_on;
$bbcode->allow_smilies = $smilies_on;

=================

$bbcode->allow_html = ($board_config['allow_html'] ? $board_config['allow_html'] : false);
$bbcode->allow_bbcode = ($board_config['allow_bbcode'] ? $board_config['allow_bbcode'] : false);
$bbcode->allow_smilies = ($board_config['allow_smilies'] ? $board_config['allow_smilies'] : false);

=================

$bbcode->allow_html = $board_config['allow_html'];
$bbcode->allow_bbcode = $board_config['allow_bbcode'];
$bbcode->allow_smilies = $board_config['allow_smilies'];

=================

$bbcode->allow_html = (($board_config['allow_html'] && $row['enable_bbcode']) ? true : false);
$bbcode->allow_bbcode = (($board_config['allow_bbcode'] && $row['enable_bbcode']) ? true : false);
$bbcode->allow_smilies = (($board_config['allow_smilies'] && $row['enable_smilies']) ? true : false);

=================

$bbcode->allow_html = ($board_config['allow_html'] && $postrow[$i]['enable_bbcode'] ? true : false);
$bbcode->allow_bbcode = ($board_config['allow_bbcode'] && $postrow[$i]['enable_bbcode'] ? true : false);
$bbcode->allow_smilies = ($board_config['allow_smilies'] && $postrow[$i]['enable_smilies'] ? true : false);

=================

$bbcode->allow_smilies = ($board_config['allow_smilies'] ? $board_config['allow_smilies'] : false);
$bbcode->allow_bbcode = ($board_config['allow_bbcode'] ? $board_config['allow_bbcode'] : false);
//$bbcode->allow_bbcode = ($bbcode_uid != '' ? $board_config['allow_bbcode'] : false);
=================

=================================
Acronyms, Autolinks, Word Wrap
=================================

$orig_autolink = array();
$replacement_autolink = array();
obtain_autolink_list($orig_autolink, $replacement_autolink, 99999999);
if(function_exists('acronym_pass'))
{
$text = acronym_pass($text);
}
if(count($orig_autolink))
{
$text = autolink_transform($text, $orig_autolink, $replacement_autolink);
}
$text = kb_word_wrap_pass ($text);
====================


DWho [ Mon 11 Aug, 2008 11:34 ]
Post subject: Re: How To Add Icy Phoenix BBCode Parsing To MODS Or Other P
thanks for the extra help with this ... I can see it a bit clearer now so I am going to have another play around with it....

:mrgreen: :mrgreen:


DWho [ Sun 24 Aug, 2008 14:08 ]
Post subject: Re: How To Add Icy Phoenix BBCode Parsing To MODS Or Other P
Thanks so much for the help.... omg it was so easy it scares me.... thanks Lopalong for simplifying it...

:mryellow: :mryellow:




Powered by Icy Phoenix