PostNuke: A Flexible Open Source Content Management System
home | forum | international support | contact us

Plugin Release Database

MuBBcode (title tags for bbcode) - v0.9

Author: Mumuri

PostNuke Version: PostNuke adam_baum .800

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." " icon_wink ){
      $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" icon_wink ;
    
    with
    define("TITLEBBTAGS","titre" icon_wink ;
    
  • 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:


 


 

2 Comments so far

(Latest comments )

Landseer's Avatar

1. Landseer wrote on Sep 27, 2007 at 01:31 PM

Nice one.

You can also use SIZE-bbcode tag to make some text portions large or small. Although not really a h(x) in means of semantic correct markup you do not need to allow the h(x) tags in your system as this can lead to unwanted side effects.

mumuri's Avatar

2. mumuri wrote on Sep 28, 2007 at 11:21 AM

yes but if h(x) tags are not allowed, when i use the "Ajax edit" function of pnForum 2.7, ce tags are displayed, i mean &.lt; &.gt; in term of source code.

and we have to reload the page to have the good version.

Main Menu

Extensions Database

Documentation

Development

Login





 


 Log in Problems?
 New User? Sign Up!

Donate to PostNuke