Custom BBCodes [Deprecated]

Get help developing custom BBCodes or request one.
bob4
Registered User
Posts: 42
Joined: Sun Oct 10, 2004 3:41 pm

Re: Custom BBCodes

Post by bob4 »

I can't seem to get an edit button to work as I have seen it on other forums.

Code: Select all

[edit] [/edit]
Looks like
Image

Any ideas .
Thanks
User avatar
ChrisRLG
Former Team Member
Posts: 3420
Joined: Wed Nov 24, 2004 3:18 pm
Location: Essex, UK
Contact:

Re: Custom BBCodes

Post by ChrisRLG »

Set your Custom BB Code as follows in this link.

Code: Select all

http://www.cjwdavis.co.uk/own/phpBB3/viewtopic.php?f=11&t=10
This is one of the easier BB Codes to install.
My test forum also has a testing room for you (or other guests) to try them out (only those I have installed to my test forum).
phpBB: The All Important Rules - Bertie Bear 3.0 - No support via PM system - use the forums please.
phpBB v2: Retirement (1/1/2009) : phpBB v3: Read Me Topic - Custom BBCodes - Support Template
Matthew 7:7"Ask and it will be given to you; seek and you will find; knock and a door will be opened to you."
My Links: MS MVP (Consumer Security) - Malware Removal:University - Own Forum: Custom BBCode testing
bob4
Registered User
Posts: 42
Joined: Sun Oct 10, 2004 3:41 pm

Re: Custom BBCodes

Post by bob4 »

Thanks Very much ChrisRLG. Worked like a charm this time.
Say, don't I know you from somewhere? ;)
User avatar
nexties
Registered User
Posts: 159
Joined: Sun Dec 24, 2006 8:06 pm
Location: Isaac Asimov's Robot City
Contact:

Re: Custom BBCodes

Post by nexties »

ship9 wrote:Please help I am looking to see if i can add videos from cnn like we can from youtube . if so what is the BBCode usage and the HTML replacement.
thank you so much for the help.
David
Goto http://www.cnnfan.com ... There is an early working prototype there that is being released here.
nicholas.alipaz
Registered User
Posts: 91
Joined: Fri Jun 15, 2007 12:43 pm
Location: Los Angeles, CA

Re: Custom BBCodes

Post by nicholas.alipaz »

sakm wrote:
nicholas.alipaz wrote:
sakm wrote:
sakm wrote:i have got a problem with the spoiler BBcode
...
thanks stu
anyone ?? :)
If a user is experiencing an issue with that spoiler, it is most likely because their browser blocks javascript. It works fine the way you posted it.

The only alternative would be to use a css spoiler rather than javascript. But someone would need to right one. I think I wrote one, but it doesn't do exactly what that one does.

when any member uses it his/her text in the post is made bigger not just for him everyone can see that no matter what browser they are using
Try removing the part:

Code: Select all

</span>
and

Code: Select all

<span class="postbody">
Alternatively, try maybe altering that postbody class to whatever your style may be using. It sounds to me like your site is using a different style than prosilver, and the "postbody" class may have been changed or something. It really could be the style you are using.

Here I am just guessing as I have no source or page to look at...
User avatar
OniTenshu
Registered User
Posts: 22
Joined: Thu Oct 23, 2008 7:27 pm
Location: Beverly
Contact:

Re: Custom BBCodes

Post by OniTenshu »

i finally had the time to complete my two versions of my V2 of my DivX Web Player BBCode made for more advanced users; i recommend the second version of V2 for a permanent replacement for my first but you can add both if you want:

Version 1

BBCode usage:

Code: Select all

[DivxVideo]{URL1} {URL2} {NUMBER1} {NUMBER2} {SIMPLETEXT}[/DivxVideo]
HTML replacement:

Code: Select all

<object id="ie_plugin" classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616"
            width="{NUMBER1}" height="{NUMBER2}"
            codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">

            <param name="src" value="{URL1}" />
            <param name="timeCallback" value="myTimeCallback" />
            <param name="statusCallback" value="myDivXPlugin.statusCallbackSink" />
            <param name="BufferCallback" value="myBufferCallback" />
            <param name="custommode" value="Stage6" />
            <param name="bannerEnabled" value="true" />
            <param name="bufferingMode" value="auto" />
            <param name="minVersion" value="1.4.2.7" />
            <param name="previewImage"
             value="{URL2}" />
            <param name="autoPlay" value="{SIMPLETEXT}" />
            <param name="loop" value="false" />
            
            <embed id="np_plugin" type="video/divx"
                   src="{URL1}"
                   width="{NUMBER1}" height="{NUMBER2}" timeCallback="myTimeCallback"statusCallback="myDivXPlugin.statusCallbackSink" statusCallback="myDivXPlugin.statusCallbackSink"BufferCallback="myBufferCallback"                   

    custommode="Stage6" bannerEnabled="true" bufferingMode="auto" minVersion="1.4.2.7"                    

previewImage="{URL2}"        

            autoPlay="false" loop="{SIMPLETEXT}" 
                   pluginspage="http://go.divx.com/plugin/download/">
            </embed>
    </object>
    <script language="Javascript">
    var plugin;

    if(navigator.userAgent.indexOf('MSIE')   != -1 ||
       navigator.userAgent.indexOf('Safari') != -1)
    {
        plugin = document.getElementById('ie_plugin');
    }
    else
    {
        plugin = document.getElementById('np_plugin');
    }
    </script>
    <script type="text/javascript">
     function showPluginPreferences()
    {
        plugin.ShowPreferences();
    }
        <input type="button"
           value="Configure the DivX Plug-In"
           onClick="javascript:showPluginPreferences();">
    </script>
    <script type="text/javascript">

    //
    // This is a global space JS function used by
    // the plug-in as a callback when data is downloaded
    //

    function myTimeCallback(current)
    {
         document.getElementById('currentTime').innerHTML = current;
    }

    //
    // This is an object defined to have a
    // local callback function, that we will
    // pass to the plugin as statusParameter
    //

    function DivXPluginSinks()
    {

        this.statusCallbackSink = function(status)
        {
            var s = parseInt(status);

            switch(s)
            {
                 case 10: // STATUS_PLAYING
                 document.getElementById('currentStatus').innerHTML = 'Playing';
                 break;

                 case 11: // STATUS_PAUSED
                 document.getElementById('currentStatus').innerHTML = 'Paused';
                 break;

                 case 12: // STATUS_FF
                 document.getElementById('currentStatus').innerHTML = 'Fast Forwarding';
                 break;

                 case 13: // STATUS_RW
                 document.getElementById('currentStatus').innerHTML = 'Rewinding';
                 break;

                 case 2:  // VIDEO_END
                 case 14: // STATUS_STOPPED
                 document.getElementById('currentStatus').innerHTML = 'Stopped';
                 break;
            }
        }
    }

    // Create an instance of the object

    myDivXPlugin = new DivXPluginSinks()

    </script>
Help line:

Code: Select all

[DivxVideo]...video.divx ...img.png 650 426 false. enter custom info exactly as shown w/o the "."[/DivxVideo]
Version 2:

BBCode usage:

Code: Select all

[DivxVideo]{URL1} {URL2} {NUMBER1} {NUMBER2} {SIMPLETEXT}[/DivxVideo]
HTML replacement:

Code: Select all

<object id="ie_plugin" classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616"
            width="{NUMBER1}" height="{NUMBER2}"
            codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">

            <param name="src" value="{URL1}" />
            <param name="timeCallback" value="myTimeCallback" />
            <param name="statusCallback" value="myDivXPlugin.statusCallbackSink" />
            <param name="BufferCallback" value="myBufferCallback" />
            <param name="custommode" value="full" />
            <param name="bannerEnabled" value="true" />
            <param name="bufferingMode" value="auto" />
            <param name="minVersion" value="1.4.2.7" />
            <param name="previewImage"
             value="{URL2}" />
            <param name="autoPlay" value="{SIMPLETEXT}" />
            <param name="loop" value="false" />
            
            <embed id="np_plugin" type="video/divx"
                   src="{URL1}"
                   width="{NUMBER1}" height="{NUMBER2}" timeCallback="myTimeCallback"statusCallback="myDivXPlugin.statusCallbackSink" statusCallback="myDivXPlugin.statusCallbackSink"BufferCallback="myBufferCallback"                   

    custommode="full" bannerEnabled="true" bufferingMode="auto" minVersion="1.4.2.7"                    

previewImage="{URL2}"        

            autoPlay="false" loop="{SIMPLETEXT}" 
                   pluginspage="http://go.divx.com/plugin/download/">
            </embed>
    </object>
    <script language="Javascript">
    var plugin;

    if(navigator.userAgent.indexOf('MSIE')   != -1 ||
       navigator.userAgent.indexOf('Safari') != -1)
    {
        plugin = document.getElementById('ie_plugin');
    }
    else
    {
        plugin = document.getElementById('np_plugin');
    }
    </script>
    <script type="text/javascript">
     function showPluginPreferences()
    {
        plugin.ShowPreferences();
    }
        <input type="button"
           value="Configure the DivX Plug-In"
           onClick="javascript:showPluginPreferences();">
    </script>
    <script type="text/javascript">

    //
    // This is a global space JS function used by
    // the plug-in as a callback when data is downloaded
    //

    function myTimeCallback(current)
    {
         document.getElementById('currentTime').innerHTML = current;
    }

    //
    // This is an object defined to have a
    // local callback function, that we will
    // pass to the plugin as statusParameter
    //

    function DivXPluginSinks()
    {

        this.statusCallbackSink = function(status)
        {
            var s = parseInt(status);

            switch(s)
            {
                 case 10: // STATUS_PLAYING
                 document.getElementById('currentStatus').innerHTML = 'Playing';
                 break;

                 case 11: // STATUS_PAUSED
                 document.getElementById('currentStatus').innerHTML = 'Paused';
                 break;

                 case 12: // STATUS_FF
                 document.getElementById('currentStatus').innerHTML = 'Fast Forwarding';
                 break;

                 case 13: // STATUS_RW
                 document.getElementById('currentStatus').innerHTML = 'Rewinding';
                 break;

                 case 2:  // VIDEO_END
                 case 14: // STATUS_STOPPED
                 document.getElementById('currentStatus').innerHTML = 'Stopped';
                 break;
            }
        }
    }

    // Create an instance of the object

    myDivXPlugin = new DivXPluginSinks()

    </script>
Help line:

Code: Select all

[DivxVideo]...video.divx ...img.png 650 426 false. enter custom info exactly as shown w/o the "."[/DivxVideo]
nicholas.alipaz
Registered User
Posts: 91
Joined: Fri Jun 15, 2007 12:43 pm
Location: Los Angeles, CA

Re: Custom BBCodes

Post by nicholas.alipaz »

Elyaradine wrote:
nicholas.alipaz wrote:The only alternative would be to use a css spoiler rather than javascript. But someone would need to right one. I think I wrote one, but it doesn't do exactly what that one does.
I use a CSS one on my site. Less fuss, and very easy, but it (obviously) won't hide text if the person has CSS disabled.

BBCode:

Code: Select all

[spoiler]{TEXT}[/spoiler]
HTML Replacement:

Code: Select all

<span style="background:#000000; color:#000000">{TEXT}</span>
CSS disabled!? wha?! I have never heard of css being disabled. What browser are they using? Now css being altered by something like userChrome.css in FF or maybe stylish, then perhaps.

There is a better way to achieve that above spoiler however:

Pure CSS Spoiler (requires no javascript):
  • BBCode usage

    Code: Select all

    [spoiler]{TEXT}[/spoiler]
    HTML replacement

    Code: Select all

    <style>#cssClick a { width:90px;height:19px;text-decoration:none; } #cssClick span {display: none;} #cssClick a:active span,#cssClick a:focus span { display: block;color:red;background:#fff;line-height:normal; }</style><span id="cssClick"><a title="Show Spoiler Text" href="#showSpoiler" rel="nofollow" class="button2">Spoiler<span>{TEXT}</span></a></span>
I just made this so please let me know how it works for you. Additionally, I styled it for prosilver. It could probably be restyled just by changing some classes. If you're not using prosilver (or prosilver-based theme) then the "button" might not show up correctly.

See how it works here (this is a demo site for my pastebin mod, but I tested the bbcode on the site):
http://pbdemo.alipaz.net/viewtopic.php?f=2&t=3&p=4
nicholas.alipaz
Registered User
Posts: 91
Joined: Fri Jun 15, 2007 12:43 pm
Location: Los Angeles, CA

Re: Custom BBCodes

Post by nicholas.alipaz »

delete
sofox
Registered User
Posts: 9
Joined: Thu Nov 20, 2008 6:15 pm

Re: Custom BBCodes

Post by sofox »

How to edit the code BBCode to colorize the text accordingly to programming language that it is? don't want to see just light green default color for the text.
User avatar
A_O_C
Registered User
Posts: 2383
Joined: Sun Jul 01, 2007 11:26 pm
Location: phpbb_

Re: Custom BBCodes

Post by A_O_C »

code={language here}

Code: Select all

<?php
print 'Hello world';
?>
sofox
Registered User
Posts: 9
Joined: Thu Nov 20, 2008 6:15 pm

Re: Custom BBCodes

Post by sofox »

What about other languages? I tried "c" and "cpp" but not successful. May be the syntax only valid with php?
User avatar
MasterZ
Registered User
Posts: 712
Joined: Wed Sep 24, 2003 5:33 am
Contact:

Re: Custom BBCodes

Post by MasterZ »

A_O_C wrote:code={language here}

Code: Select all

<?php
print 'Hello world';
?>
That is awesome, I didn't know that!

Thanks :ugeek:
nicholas.alipaz
Registered User
Posts: 91
Joined: Fri Jun 15, 2007 12:43 pm
Location: Los Angeles, CA

Re: Custom BBCodes

Post by nicholas.alipaz »

MasterZ wrote:
A_O_C wrote:code={language here}

Code: Select all

<?php
print 'Hello world';
?>
That is awesome, I didn't know that!

Thanks :ugeek:
Very awesome, I didn't know that either. got me thinking what syntaxes it supported so I looking the file includes/bbcodes.php

Code: Select all

    function bbcode_second_pass_code($type, $code)
    {
        // when using the /e modifier, preg_replace slashes double-quotes but does not
        // seem to slash anything else
        $code = str_replace('\"', '"', $code);

        switch ($type)
        {
            case 'php':
                // Not the english way, but valid because of hardcoded syntax highlighting
                if (strpos($code, '<span class="syntaxdefault"><br /></span>') === 0)
                {
                    $code = substr($code, 41);
                }

            // no break;

            default:
                $code = str_replace("\t", '&nbsp; &nbsp;', $code);
                $code = str_replace('  ', '&nbsp; ', $code);
                $code = str_replace('  ', ' &nbsp;', $code);

                // remove newline at the beginning
                if (!empty($code) && $code[0] == "\n")
                {
                    $code = substr($code, 1);
                }
            break;
        }

        $code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close');

        return $code;
    } 
Sad to say, it only does "php" and nothing for syntaxes. Pretty limited, would've been nice if they added geshi syntax highlighting. Maybe someone can make a mod, but that is a different topic.
User avatar
A_O_C
Registered User
Posts: 2383
Joined: Sun Jul 01, 2007 11:26 pm
Location: phpbb_

Re: Custom BBCodes

Post by A_O_C »

nicholas.alipaz wrote:would've been nice if they added geshi syntax highlighting. Maybe someone can make a mod
search does a wonderful thing :D

*EDIT* although there are a few things the pluck my nerves about this MOD, it works fine in 3.0.3 (i took out a few of the "features").
User avatar
nexties
Registered User
Posts: 159
Joined: Sun Dec 24, 2006 8:06 pm
Location: Isaac Asimov's Robot City
Contact:

Custom BBCode to embed CNN.com Video

Post by nexties »

Below is the popular Custom BBCode to embed CNN.com Video frequently asked for on this board.

To use the following CNN.com Video custom BBCode, navigate to the Posting => BBCodes section of the phpBB3 administration panel and click the "Add a new BBCode" button. Enter the respective code from below into the "BBCode usage" and "HTML replacement" boxes.

Index
  • Description
  • How To
  • BBCode usage
  • HTML Replacement
  • Test Results
  • Known Issues
  • Epilogue
  • Description: Allows you to embed CNN.com videos in your posts using a snippet of Javascript.

    How To:
    Copy the embed code from the CNN.com Video and get the value from vid variable:
    <script src="http://i.cdn.turner.com/cnn/.element/js ... c=dom&vid=/video/world/2008/11/19/moos.sarkozy.singing.wife.cnn" type="text/javascript"></script><noscript>Embedded video from <a href="http://www.cnn.com/video">CNN Video</a></noscript>
    Then use the custom bbcode button on the value of the vid variable in your post.

    Example:

    Code: Select all

    [cnnvideo]/video/world/2008/11/19/moos.sarkozy.singing.wife.cnn[/cnnvideo]

    BBCode usage:

    Code: Select all

    [CNNvideo]{LOCAL_URL}[/CNNvideo]
    HTML Replacement:

    Code: Select all

    <script src="http://i.cdn.turner.com/cnn/.element/js/2.0/video/evp/module.js?loc=dom&vid=
    {LOCAL_URL}" type="text/javascript"></script><noscript>Embedded video from <a href="http://www.cnn.com/video">CNN Video</a></noscript>
  • Test results:

    Works perfectly in Internet 7 on Windows
    Works perfectly in Safari on the Mac and iPhone
    Works perfectly in FireFox 2.0.0.1 on the Mac
    Works perfectly in FireFox 3.0.2 on Ubuntu 8 Linux
  • Known Issues:
    Initial test of FireFox 3.0.2 on CentOS 5 Linux had the following error:

    MALFORMED ERROR
    This video you are attempting to embed does
    not exist.
    Please check your URL and try again
Epilogue

If you have any suggestions or find an error in the above article, please do not hesitate to contact me.
For more BBCodes see this knowledge base article: Adding Custom BBCodes in phpBB3
Please support the CNNfan Community by giving credit for this custom bbcode to: Tom Joyce
Locked

Return to “Custom BBCode Development and Requests”