【问题标题】:Pear HTML BBcode HyperlinkPear HTML BBcode 超链接
【发布时间】:2011-02-20 08:33:24
【问题描述】:

有人用过 PEAR HTML BBcode 包吗?

我真的不明白为什么超链接目标 _blank 没有在 Firefox 中打开新标签。

SQL 插入片段(字符串)

[url=http://site.com t=_blank]Link[/url]

PHP 需要 PEAR

require_once 'HTML/BBCodeParser.php';
$options = @parse_ini_file('BBCodeParser.ini');  
$parser = new HTML_BBCodeParser($options);
$parser->setText($text);
$parser->parse();
echo $parser->getParsed();

BBCodeParser.ini

[HTML_BBCodeParser]
; http://articles.sitepoint.com/article/bb-code-php-application/
; possible values: single|double
; use single or double quotes for attributes
quotestyle  = double

; possible values: all|nothing|strings
; quote all attribute values, none, or only the strings
quotewhat   = all

; the opening tag character
open        = "["

; the closing tag character
close       = "]"

; possible values: true|false
; use xml style closing tags for single html tags (<img> or <img />)
xmlclose    = true

; possible values: a comma seperated list of filters
; comma seperated list of filters to use
filters     = Basic,Extended,Links,Images,Lists
; filters     = Basic,Extended,Links,Images,Lists,Email,MyBB

【问题讨论】:

    标签: php pear


    【解决方案1】:

    似乎 /filter/links.php 的默认代码在 &lt;a&gt; 标记中不包含目标属性。如果您更改 &lt;a&gt; 标记代码以添加 t =&gt; 'target=_blank',它应该可以解决问题。

    我还不确定如何添加其他值,例如 _self_top_parent

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-01
      • 1970-01-01
      • 2012-03-04
      • 1970-01-01
      • 2011-03-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多