PostNuke Community

Support at your fingertips

MuBBcode (title tags for bbcode) - v0.9

Author: Mumuri

Zikula Version: Zikula 1.0.0

Type: pnRender

Description:

For Top Flood my discussion board, i needed a way to present some article like a word document with "title 1", "title 2" ...


Description

If you look in Word, there is some buttons which allow you to format your text with titles.

postnuke bbcode

I want to do the same thing with bbcode, here is a small overview of "what the plugin does"

postnuke bbcode

You will see that this plugin can help you to format a webpage (this is good for SEO).

How to

Notes

For lazy people, i ve done a pack with all the file for pn_bbcode 1.22 (tested with pnforum 2.7 with the bbcode hook). You just have to copy paste to the root of your postnuke. (you have to allow H1,H2,H3,H4 tags with attributes too)

For the others ...

"Technical part"

  • copy "MuBBcode.php" to "modules\pn_bbcode\pnincludes\"
  • edit modules\pn_bbcode\pnuserapi.php
    • find
      if(!class_exists('GeSHi')) {
      include_once('modules/pn_bbcode/pnincludes/geshi.php');
      }
      add after
      include_once('modules/pn_bbcode/pnincludes/MuBBcode.php');
    • find
      $message = pn_bbcode_encode_quote($message);
      add after
      if (strpos(strtolower($message), "[".TITLEBBTAGS." ")){
      $message = MuBBCode_RecScan($message);
      }
    • go in the administration center, click on "settings", "html options", then allows H1,H2,H3,H4 tags with attributes

"Graphical part"

  • copy "bb_word.gif" to "modules\pn_bbcode\pnimages"
  • open modules\pn_bbcode\pntemplates\pn_bbcode_user_bbcodes.html find
    <!--[ if $size_enabled eq "yes" ]-->
        <!--[ pnml name='_PNBBCODE_FONTSIZE' ]-->:
        <select name="fontsize" title="<!--[ pnml name='_PNBBCODE_SIZE_HINT' ]-->">
            <option value="tiny"><!--[ pnml name='_PNBBCODE_SIZE_TINY' ]--></option>
            <option value="small"><!--[ pnml name='_PNBBCODE_SIZE_SMALL' ]--></option>
            <option selected="true" value="normal">
    		<!--[ pnml name='_PNBBCODE_SIZE_NORMAL' ]--></option>
            <option value="large"><!--[ pnml name='_PNBBCODE_SIZE_LARGE' ]--></option>
            <option value="huge"><!--[ pnml name='_PNBBCODE_SIZE_HUGE' ]--></option>
        
            <option value="<!--[ pnml name='_PNBBCODE_SIZE_TEXTSIZE' ]-->">
    		<!--[ pnml name='_PNBBCODE_SIZE_DEFINE' ]--></option>
        
        </select>  
    <!--[ /if ]-->
    
    add after
    <!-- MuBBcode  - http://forum.topflood.com -->
    <select name="titleWord" style="height: 12px; width: 60px; float: right;">
    	<option value="1" accesskey="1" style="color: red; font-size: 14px; font-weight: bold; background-color: rgb(222, 227, 231); padding-left: 2px;">
    	<!--[ pnml name='_PNBBCODE_TITLE' ]--> 1</option>
    	<option value="2" accesskey="2" style="color: green; font-size: 12px; font-weight: bold; background-color: rgb(222, 227, 231); padding-left: 8px;">
    	<!--[ pnml name='_PNBBCODE_TITLE' ]--> 2</option>
    	<option value="3" accesskey="3" style="color: darkblue; font-size: 11px; font-weight: bold; background-color: rgb(222, 227, 231); padding-left: 12px;">
    	<!--[ pnml name='_PNBBCODE_TITLE' ]--> 3</option>
    </select>      
    
    <!--[pnimg src="bb_word.gif" ]-->
  • open "modules\pn_bbcode\pnlang\eng\global.php" add in the file
    define('_PNBBCODE_TITLE','Title');
    
  • open "modules\pn_bbcode\pnjavascript\bbcode_common.js" find
    	case "listitem":
                aTag = "[*]";
                eTag = "";
                break;
    
    Add after
    	case "title":
                aTag = "[title "+optdata+ "]";
                eTag = "[/title]";
                break;
    
  • edit "modules\pn_bbcode\pnstyle\style.css" and add
    h2.MuBBCode_titre{
    	color:red;
    }
    
    h3.MuBBCode_titre{
    	color:blue;
    	padding-left:20px;
    }
    
    h4.MuBBCode_titre{
    	color:green;
    	padding-left: 40px;
    }

"Tips"

If you don't want to write "title" in the text but "titre" (title in french), you can do like this
  • edit "MuBBcode.php" replace
    define("TITLEBBTAGS","title");
    
    with
    define("TITLEBBTAGS","titre");
    
  • edit "bbcode_common.js" replace
    	case "title":
                aTag = "[title "+optdata+ "]";
                eTag = "[/title]";
                break;
    
    by
    	case "title":
                aTag = "[titre "+optdata+ "]";
                eTag = "[/titre]";
                break;
    
André Bergues

Support Information:



Change Log: