0

我试图找到一种在 PHPBB 中启用 HTML 标签的方法(仅用于管理)。

你知道我怎样才能做到这一点吗?

谢谢

4

2 回答 2

3

开箱即用不支持此功能。您应该改用自定义 BBCode。如果你真的,真的坚持使用 HTML 标签,你可以使用Enable HTML MOD。

于 2010-10-10T16:27:45.160 回答
1

最近我忙着将基于 Snitz 2.x 的论坛移植到 phpbb3 论坛。我必须处理的主要挑战是文章正文中的 HTML 支持。Snitz 允许在帖子正文中使用 HTML,但 phpbb3禁止在帖子中使用 HTML 标签。由于我们有大约 40000 个帖子,其中许多包含 HTML 标签,我们必须为此找到解决方案。
这里是:
我们使用了Enable HTML MOD但我们对其进行了修改。原函数:

function enable_html($text, $uid)
{
    if (strpos($text, '[html') === false)
    {
        return $text;
    }

    $text = str_replace(array('[html:' . $uid . ']', '[/html:' . $uid . ']'), array('[html]', '[/html]'), $text);

    $text_ary = explode('[html]', $text);
    $text = '';
    foreach ($text_ary as $tmp)
    {
        if (strpos($tmp, '[/html]'))
        {
            $tmp = explode('[/html]', $tmp, 2);
            $text .= htmlspecialchars_decode(str_replace(array("\r\n", "\n"), ' ', $tmp[0])) . $tmp[1];
        }
        else
        {
            $text .= $tmp;
        }
    }

    return str_replace(array('[html]', '[/html]'), '', $text);
}

被修改为

function enable_html($text, $uid)
{
    return htmlspecialchars_decode($text);
}

最后一步是给用户新的权限,我们得到了在 Snitz 中呈现的 HTML。

于 2012-03-15T14:45:33.063 回答