找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 82|回复: 0

[cms教程] discuz x帖子内容[attach]转html

[复制链接]

该用户从未签到

发表于 2019-4-5 14:55:00 | 显示全部楼层 |阅读模式

您需要 登录 才可以下载或查看,没有账号?立即注册

×
discuz x帖子内容[attach]转html
            
            之前用过
{echo discuzcode($value['message',, 0,0, 0] 1, 1, 0,0, 0,0, 0);}
或者
require_once libfile('function/discuzcode');
{echo discuzcode($value['message',);}
能转大部分UBB,但是[attach]转不了。
下面是来自网络的代码,针对attach。
我用的时候做了一些修改。
       
               
                       
                               
fetch ( 'aid:' . $aid, $aid, array (1,- 1) )) {
return get_lw_attach_path_str ( $attach );
}
return $filename;
}
function get_lw_attach_path_str($attach) {
global $_G;
if (! $attach ['isimage',) {
return '[url=,' . $attach ['filename', . '[/url]';
}
if ($attach ['remote',) {
$imgurl = $_G ['setting', ['ftp', ['attachurl', . 'forum/' . $attach ['attachment',;
return '
[img][/img]
';
} else {
if (preg_match ( '/^(?!http:)/', $attach ['url', )) {
$attach ['url', = $_G ['siteurl', . 'data/attachment/forum/' . $attach ['url',;
}
$imgurl = $attach ['url', . $attach ['attachment', . ($_G ['gp_width', ? '&width=' . $_G ['gp_width', : '') . ($_G ['gp_height', ? '&height=' . $_G ['gp_height', : '');
return '[url=,
[img][/img]
[/url]
';
}
}
?>
                       
               
       
条件where b.pid=$pid,如果只调用主题帖内容,改为where a.tid=$tid and b.first=1。
$pid或$tid使用时需要先获得。
在调用帖子内容时,另外涉及到权限问题,如密码、隐藏内容、查看权限、主题售价等等。
回复

使用道具 举报

网站地图|页面地图|文字地图|Archiver|手机版|小黑屋|找资源 |网站地图

GMT+8, 2024-10-6 01:36

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表