A script that uses PHP to turn UBB into HTML (to support tables)

Source: Internet
Author: User
Well, you can also write a form when you see some forums that use UBB.
Can actually give this piece of code is OK.
The syntax seems to be
[TBL]
|a1|s2|s3|
|b1|b2|b3|
|c1|c2|c3|
[/TBL]
Of course, you can also separate them with commas.
You are too weak to write.
Thank you


Reply to discussion (solution)

$s =<<< ubb[tbl]|a1|s2|s3| | b1|b2|b3| | c1|c2|c3| [/TBL] UBB; $s = Preg_replace_callback ('/\[tbl\] (. +) \[\/tbl\]/isu ', ' tbl_func ', $s); echo $s; function Tbl_func ($r) {  $t = Preg_replace (Array ('/^\|/m ', '/\|\r?$/m ', '/\|/m '), Array (', ', '), $r [1]);  Return "
 
 
 
  
  
  $t
 
 
 
";}




A1 S2 S3
B1 B2 B3
C1 C2 C3


Other tags do the same
  • 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.