开发者

PHP Basic BBcode

开发者 https://www.devze.com 2023-01-17 17:42 出处:网络
I\'ve managed to successfuly integrate BBCode, but I was wondering say if I wanted to dynamically list all the allowed/accepted BBCo开发者_如何学运维de - how would I be able to do that? (as it can be

I've managed to successfuly integrate BBCode, but I was wondering say if I wanted to dynamically list all the allowed/accepted BBCo开发者_如何学运维de - how would I be able to do that? (as it can be tedious manually writing out...and if the BBCode ever changed I'd have to update the writing)

I current have a BBCode() function, which contains 2 arrays, one which contains the regex, and the other which contains the replacements (html), and then I return a preg_replace() of the regex array with the replacement (html) array.

Cheers and looking forward to your inputs!


Consider using a different markup language like Textile or Markdown. Simply saying that you support Markdown or Textile is decent enough; they're so widely used that users could easily look up the markup for them online.

Textile's syntax hasn't been updated since 2006, so it will likely remain very solid for years to come. Markdown's syntax hasn't been updated since 2004.

Both provide excellent PHP libraries:

  • http://michelf.com/projects/php-markdown/
  • http://textile.thresholdstate.com/
0

精彩评论

暂无评论...
验证码 换一张
取 消