Use php to convert ubb into html scripts (tables must be supported)

Source: Internet
Author: User
Ask for a script to convert ubb into html using php (to support tables). well, we can see that ubb can be used in some forums to write tables. In fact, this piece of code can also be provided. The syntax seems to be [tbl] | a1 | s2 | s3 | b1 | b2 | b3 | c1 | c2 | c3 | [/tbl]. of course, you can also use commas to separate them. I cannot write it out because I am too weak .. Thank you for asking for a script to convert ubb into html using php (table support)
Well, we can see that some forums use ubb and you can also write tables.
In fact, this piece of code can also be provided.
The syntax seems to be
[Tbl]
| A1 | s2 | s3 |
| B1 | b2 | b3 |
| C1 | c2 | c3 |
[/Tbl]
Of course, they can also be separated by commas.
I cannot write it out because I am too weak ..
Thank you, php ubb html.
------ Solution --------------------
$ S = <UBB
[Tbl]

------ Solution --------------------
A1
------ Solution --------------------
S2
------ Solution --------------------
S3
------ Solution --------------------


------ Solution --------------------
B1
------ Solution --------------------
B2
------ Solution --------------------
B3
------ Solution --------------------


------ Solution --------------------
C1
------ Solution --------------------
C2
------ Solution --------------------
C3
------ Solution --------------------

[/Tbl]
UBB;

$ S = preg_replace_callback ('/\ [tbl \] (. +) \ [\/tbl \]/isU', 'tbl _ func', $ s );
Echo $ s;

Function tbl_func ($ r ){
$ T = preg_replace (array ('/^ \
------ Solution --------------------
/M ','/\
------ Solution --------------------
\ R? $/M ','/\
------ Solution --------------------
/M'), array ('','',''), $ R [1]);
Return" $ T
";
}




A1 S2 S3
B1 B2 B3
C1 C2 C3


Other tags are processed as examples

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.