Codeigniter BBCODE 还是即时功能?
我一直在寻找某种方法来使用 bbcode 对链接进行编码,或者手动将指定消息中的 url 转换为链接。 BBCodes 对我来说有点过时了。尽管如此,仍然大量用于诸如笑脸等之类的事情。
我希望可能混合使用这两种功能。
可以这么说,任何人都可以就他们使用或最近使用过的用于美化消息系统的东西提出建议。
I've been looking around for some way to either code up links using bbcode or manually convert a url in a specified message to a link. BBCodes to me are just getting a little old. Although, are still massively heavily used for such things as smileys etc.
I'd be looking to probably do a mixture of the two functionalities.
Can anyone advise on something they use or have used recently for prettifying a messaging system, so to speak.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
至于转换链接,Codeigniter 为您提供了 url 助手:
至于表情符号,也包括在内。实际上有一个 smiley helper:
如果你放弃并想解析 bbcode,这里有一个由 Phil Sturgeon(Codeigniter 首席开发人员)编写的帮助程序:https://github.com/bcit-ci/CodeIgniter/wiki/BBCode-Helper
As far as converting links, Codeigniter's got you covered with the url helper:
As for smilies, that's covered as well. There is actually a smiley helper:
If you give up and want to parse bbcode, here's a helper written by Phil Sturgeon (a lead Codeigniter developer): https://github.com/bcit-ci/CodeIgniter/wiki/BBCode-Helper
如果您想使用客户端进行 BBCode 解释,我已经编写了 JavaScript 中的可扩展 BBCode 解析器。
它具有所有标准 BBCode 标签,但如果您的消息传递系统需要一些新标签来进行某些类型的 URL 操作,则可以轻松添加它们。例如,对于表情符号标记,您可以像这样扩展它:
然后 BBCode 看起来像这样:
从中生成的 HTML 代码看起来像这样:
这可能比您想要的更多工作,您可能会这样做不想为您的消息传递系统使用自己的自定义标签,但我想我应该提及它以防万一。
If you wanted to go with something client side for BBCode interpritation, I've written an extendible BBCode parser in JavaScript.
It has all of the standard BBCode tags, but if your messaging system needed some new tags for certain kinds of URL manipulation they could be easily added. As an example, for a smilies tag you could extend it like this:
And then the BBCode would look something like:
And the HTML code it would generate from that would look like this:
This might be more work than what you want and you may not want your own custom tags for your messaging system, but I figured I'd mention it just in case.