Custom BBCodes [Deprecated]

Get help developing custom BBCodes or request one.
Michael Regan
Registered User
Posts: 55
Joined: Thu Jan 07, 2010 10:05 pm

Re: Custom BBCodes

Post by Michael Regan » Fri Feb 25, 2011 5:11 pm

While I'm waiting for an answer to my LIST question, I do have an alternate to the TABLE code.

Create the following three BBCodes
TABLE
BBCode Usage

Code: Select all

[TABLE]{TEXT}[/TABLE]
HTML Replacement

Code: Select all

<div style="line-height: 0px"><table style="border-collapse: collapse; border-color: #000000;" cellpadding="0" cellspacing ="0" width=100% border="1">{TEXT}</table></div>
ROW
BBCode Usage

Code: Select all

[ROW]{TEXT}[/ROW]
HTML Replacement

Code: Select all

<tr>{TEXT}</tr>
CELL
BBCode Usage

Code: Select all

[CELL]{TEXT}[/CELL]
HTML Replacement

Code: Select all

<td style="line-height: 100%; border-color: #000000; padding: 9px;" valign=top>{TEXT}</td>
To use this, nest the your CELL codes within ROW codes and ROW codes within TABLE code. This format will allow some blank spaces between individual BBCodes making it easier to review your work.

With this variation you can enter your work as follows to more easily follow what you have entered:

Code: Select all

[table]

[row]
[cell]Top Left[/cell]
[cell]Top Right[/cell]
[/row]

[row]
[cell]Bottom Left[/cell]
[cell]Bottom Right[/cell]
[/row]

[/table]
But when you return to edit, the forum with "condense" as follows, which is still much easier to review:

Code: Select all

[table][row][cell]Top Left[/cell]
[cell]Top Right[/cell][/row]

[row][cell]Bottom Left[/cell]
[cell]Bottom Right[/cell][/row][/table]
Hope this helps

User avatar
AmigoJack
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Custom BBCodes

Post by AmigoJack » Fri Feb 25, 2011 6:00 pm

Michael Regan wrote:Rather than make a replacement BBCode, is there a way to alter the existing LIST code to allow numberic listing to begin at a numebr other than one?
It's not that simple, but possible.

Open /includes/bbcode.php and find:

Code: Select all

    function bbcode_list($type)
    { 
After, add:

Code: Select all

        /*** 2011-02-25 BEGIN AmigoJack
            Allow a start parameter ***/
        $sStart= '';
        if( preg_match( '#^[^,"\'],([0-9]+)$#', $type, $aMatch ) ) {
            $sStart= '" start="'. $aMatch[1];
            $type= substr( $type, 0, -strlen( $aMatch[1] )- 1 );
        }
        /*** 2011-02-25 END ***/ 
Find:

Code: Select all

        return str_replace('{LIST_TYPE}', $type, $this->bbcode_tpl($tpl));
    } 
Before, add:

Code: Select all

        /*** 2011-02-25 BEGIN AmigoJack
            Add possible HTML start attribute ***/
        $type.= $sStart;
        /*** 2011-02-25 END ***/ 
Open /includes/message_parser.php and find:

Code: Select all

            'list'            => array('bbcode_id' => 9,    'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#ise' => "\$this->bbcode_parse_list('\$0')")), 
Replace with:

Code: Select all

            /*** 2011-02-25 BEGIN AmigoJack
                Also allow optional start ***/
            //'list'            => array('bbcode_id' => 9,    'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#ise' => "\$this->bbcode_parse_list('\$0')")),
            'list'            => array('bbcode_id' => 9,    'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?(,[0-9]+)?].*\[/list]#ise' => "\$this->bbcode_parse_list('\$0')")),
            /*** 2011-02-25 END ***/ 
Find:

Code: Select all

                else if (preg_match('#^list(=[0-9a-z]+)?$#i', $buffer, $m)) 
Replace with:

Code: Select all

                /*** 2011-02-25 BEGIN AmigoJack
                    Allow optional start parameter ***/
                //else if (preg_match('#^list(=[0-9a-z]+)?$#i', $buffer, $m))
                else if (preg_match('#^list(=[0-9a-z]+)?(,[0-9]+)?$#i', $buffer, $m))
                /*** 2011-02-25 END ***/ 
Tested.

Now you have an optional second parameter for the list BBCode, separated by a comma and the ordinal. Example:

Code: Select all

[list=a,5]
[*]starts with letter e, because it's the 5th
[*]continues with letter f, because it's the 6th
[*]... (works for all ordered list style types: 0, a, A, i, I)
[/list]
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

User avatar
AmigoJack
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Custom BBCodes

Post by AmigoJack » Fri Feb 25, 2011 6:07 pm

Michael Regan wrote:While I'm waiting for an answer to my LIST question, I do have an alternate to the TABLE code
That one produces invalid HTML, since all line breaks between <table> to <tr> and <tr> to <td> will be replaced by HTML linebreaks (<br/>) and those aren't allowed between table-related tags. Your code only works if without any linebreaks at all between those. HTML table BBCodes have been discussed (and "solved") numerous times. Unfortunately this topic is too long quickly find appropriate posts.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

Michael Regan
Registered User
Posts: 55
Joined: Thu Jan 07, 2010 10:05 pm

Re: Custom BBCodes

Post by Michael Regan » Fri Feb 25, 2011 6:40 pm

Thanks for the LIST option, I'll give that a look this weekend :), but quick question following a quick glance: Does your alteration allow for the regular usage of LIST=1 with the option of the jumps?
AmigoJack wrote:
Michael Regan wrote:While I'm waiting for an answer to my LIST question, I do have an alternate to the TABLE code
That one produces invalid HTML, since all line breaks between <table> to <tr> and <tr> to <td> will be replaced by HTML linebreaks (<br/>) and those aren't allowed between table-related tags. Your code only works if without any linebreaks at all between those. HTML table BBCodes have been discussed (and "solved") numerous times. Unfortunately this topic is too long quickly find appropriate posts.
No, the code displayed does not insert the </br> other options do. I have it installed and use it regularly as with my example.

Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Custom List Start BBCode

Post by Pony99CA » Sat Feb 26, 2011 3:06 am

Michael Regan wrote:Rather than make a replacement BBCode, is there a way to alter the existing LIST code to allow numberic listing to begin at a numebr other than one?

[...]

I believe this is a simple BBCode alteration (once I know how), but I do not want to alter the original and make it overly complicated to use if possible.
First you say that you want to alter the original, then you say that you don't. Which is it?

If you want to alter the existing LIST= BBCode, that's a MOD request, not a Custom BBCode.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

paktv
Registered User
Posts: 37
Joined: Thu Nov 11, 2010 8:30 am

Re: Custom BBCodes

Post by paktv » Sun Feb 27, 2011 9:42 am

can anyone make a bbcode for veemi.com live streaming? Thanks.

Url:

Code: Select all

http://www.veemi.com/watch?v=khans4563
Embed code:

Code: Select all

<script type="text/javascript"> fid="khans4563"; v_width="500"; v_height="300";</script><script type="text/javascript" src="http://veemi.com/javascript/embedPlayer.js"></script>

User avatar
TheSnake
Registered User
Posts: 483
Joined: Wed Aug 09, 2006 10:36 pm
Location: Staffordshire, England, UK
Contact:

Re: Custom BBCodes

Post by TheSnake » Sun Feb 27, 2011 3:58 pm

The video stream is not working. The admin of that site has deleted the video stream you posted.

Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Custom BBCodes

Post by Pony99CA » Sun Feb 27, 2011 8:49 pm

paktv wrote:can anyone make a bbcode for veemi.com live streaming? Thanks.

Url:

Code: Select all

http://www.veemi.com/watch?v=khans4563
Embed code:

Code: Select all

<script type="text/javascript"> fid="khans4563"; v_width="500"; v_height="300";</script><script type="text/javascript" src="http://veemi.com/javascript/embedPlayer.js"></script>
Like almost any other video source with an ID, make the ID a replacement variable. I haven't tested this, but something like the following should work:

BBCode usage

Code: Select all

[veemi]{IDENTIFIER}[/veemi]
HTML Replacment

Code: Select all

<script type="text/javascript"> fid="{IDENTIFIER}"; v_width="500"; v_height="300";</script>
<script type="text/javascript" src="http://veemi.com/javascript/embedPlayer.js"></script>
It really should be that easy, whether or not provided stream exists.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

Michael Regan
Registered User
Posts: 55
Joined: Thu Jan 07, 2010 10:05 pm

Re: Custom List Start BBCode

Post by Michael Regan » Tue Mar 01, 2011 12:43 am

Pony99CA wrote:
Michael Regan wrote:Rather than make a replacement BBCode, is there a way to alter the existing LIST code to allow numberic listing to begin at a numebr other than one?

[...]

I believe this is a simple BBCode alteration (once I know how), but I do not want to alter the original and make it overly complicated to use if possible.
First you say that you want to alter the original, then you say that you don't. Which is it?

If you want to alter the existing LIST= BBCode, that's a MOD request, not a Custom BBCode.

Steve
Actually, if there is a way to crate a secondary list code that would suffice, which is actually what I was hoping for. I mistyped "replacement" when I actually meant "alternate".

Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Custom List Start BBCode

Post by Pony99CA » Tue Mar 01, 2011 2:26 am

Michael Regan wrote:
Pony99CA wrote:
Michael Regan wrote:Rather than make a replacement BBCode, is there a way to alter the existing LIST code to allow numberic listing to begin at a numebr other than one?

[...]

I believe this is a simple BBCode alteration (once I know how), but I do not want to alter the original and make it overly complicated to use if possible.
First you say that you want to alter the original, then you say that you don't. Which is it?

If you want to alter the existing LIST= BBCode, that's a MOD request, not a Custom BBCode.
Actually, if there is a way to crate a secondary list code that would suffice, which is actually what I was hoping for. I mistyped "replacement" when I actually meant "alternate".
You might try reading the Make OL list start from number different than 1 using CSS article. You can use the deprecated HTML version fairly easily if you create an OL BBCode.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

User avatar
AmigoJack
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Custom List Start BBCode

Post by AmigoJack » Tue Mar 01, 2011 6:47 am

Michael Regan wrote:Actually, if there is a way to crate a secondary list code that would suffice, which is actually what I was hoping for
For what reason? You can use the existing one if you want to do recursion:

Code: Select all

[list=1]
[*]one
[*]two with sublist:[list=a]
  [*]first
  [*]second
  [/list]
[*]three
[/list]
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

Michael Regan
Registered User
Posts: 55
Joined: Thu Jan 07, 2010 10:05 pm

Re: Custom List Start BBCode

Post by Michael Regan » Tue Mar 01, 2011 2:10 pm

AmigoJack wrote:
Michael Regan wrote:Actually, if there is a way to crate a secondary list code that would suffice, which is actually what I was hoping for
For what reason? You can use the existing one if you want to do recursion:

Code: Select all

[list=1]
[*]one
[*]two with sublist:[list=a]
  [*]first
  [*]second
  [/list]
[*]three
[/list]
Strange, I thought I had tried that and it did not work. Thanks AmigoJack, I'll give that another try.

Edit: Yes, it is working but I have no idea what I was doing wrong originally. Thanks again.

cool1guy
Registered User
Posts: 24
Joined: Sun Jan 16, 2011 1:01 pm

Re: Custom BBCodes

Post by cool1guy » Sat Mar 05, 2011 5:38 pm

I am currently using a youtube BB code. A lot of confusion with it.
I want a BBCode which would simple show the youtube video.

For ex. if someone wants to post a video.
He will copy the youtube URL and paste it and choose the youtube BBcode.

For ex, like this: [youtube]http://www.youtube.com/v=videocode[/youtube]

I am unable to find such BBCode.
If anyone knows and shares, it would be great.

User avatar
keith10456
Registered User
Posts: 2315
Joined: Thu Feb 24, 2005 6:55 pm
Contact:

Re: Custom BBCodes

Post by keith10456 » Sat Mar 05, 2011 8:28 pm

Michael Regan wrote:While I'm waiting for an answer to my LIST question, I do have an alternate to the TABLE code.

Create the following three BBCodes
TABLE
BBCode Usage

Code: Select all

[TABLE]{TEXT}[/TABLE]
HTML Replacement

Code: Select all

<div style="line-height: 0px"><table style="border-collapse: collapse; border-color: #000000;" cellpadding="0" cellspacing ="0" width=100% border="1">{TEXT}</table></div>
ROW
BBCode Usage

Code: Select all

[ROW]{TEXT}[/ROW]
HTML Replacement

Code: Select all

<tr>{TEXT}</tr>
CELL
BBCode Usage

Code: Select all

[CELL]{TEXT}[/CELL]
HTML Replacement

Code: Select all

<td style="line-height: 100%; border-color: #000000; padding: 9px;" valign=top>{TEXT}</td>
To use this, nest the your CELL codes within ROW codes and ROW codes within TABLE code. This format will allow some blank spaces between individual BBCodes making it easier to review your work.

With this variation you can enter your work as follows to more easily follow what you have entered:

Code: Select all

[table]

[row]
[cell]Top Left[/cell]
[cell]Top Right[/cell]
[/row]

[row]
[cell]Bottom Left[/cell]
[cell]Bottom Right[/cell]
[/row]

[/table]
But when you return to edit, the forum with "condense" as follows, which is still much easier to review:

Code: Select all

[table][row][cell]Top Left[/cell]
[cell]Top Right[/cell][/row]

[row][cell]Bottom Left[/cell]
[cell]Bottom Right[/cell][/row][/table]
Hope this helps
Thanks!

I added it and it works ;)
Last edited by keith10456 on Mon Mar 07, 2011 4:34 pm, edited 1 time in total.

User avatar
keith10456
Registered User
Posts: 2315
Joined: Thu Feb 24, 2005 6:55 pm
Contact:

Re: Custom BBCodes

Post by keith10456 » Sat Mar 05, 2011 8:31 pm

cool1guy wrote:I am currently using a youtube BB code. A lot of confusion with it.
I want a BBCode which would simple show the youtube video.

For ex. if someone wants to post a video.
He will copy the youtube URL and paste it and choose the youtube BBcode.

For ex, like this: [youtube]http://www.youtube.com/v=videocode[/youtube]

I am unable to find such BBCode.
If anyone knows and shares, it would be great.
http://www.phpbb.com/community/viewtopic.php?t=579376

Locked

Return to “Custom BBCode Development and Requests”