discuz 帖子楼层嵌入点的使用

暂无标签

string 嵌入

$return[] = $postlist[$id]['authorid']
return $return;

class plugin_ly_reward_forum extends plugin_ly_reward{
    function viewthread_postbottom_output(){
        global $_G,$postlist;
        $setting = $_G['cache']['plugin']['ly_reward'];
        if($setting['op']){
            foreach ($postlist as $id=>$post){
                if($setting['btnhtml']){
                    $btnhtml = $setting['btnhtml'];
                    $return[] = preg_replace("/{go}/",' onclick="showWindow(\'ly_reward\',\'plugin.php?id=ly_reward:reward&act=show&uid='.$postlist[$id]['authorid'].'\')"',$btnhtml);
                }else{
                    $return[] = '<div id="p_btn" class="ptw pbw"><a href="javascript:;" onclick="showWindow(\'ly_reward\',\'plugin.php?id=ly_reward:reward&act=show&uid='.$postlist[$id]['authorid'].'\')"><i><img src="static/image/common/viewpay.gif">'.lang('plugin/ly_reward','reward').'</i></a></div>';    
                }                      
            }
            return $return;
        }
    }
}

array嵌入

    function viewthread_sidebottom_output(){
        global $_G,$postlist;
        foreach ($postlist as $id=>$post){
            $authorants = C::t("#anthology#anthology")->fetch_all("`uid` = $post[authorid]","anthology_item","id asc");
            $post['authorants'] = '<div class="mtw mbw">';
            foreach($authorants as $v){
                $post['authorants'] .= '<div style="margin:10px;padding: 5px 8px;border-radius: 4px;background: #fff;"><a href="plugin.php?id=anthology:item&mid='.$v['id'].'" c="1" target="_blank" style="display: flex;align-items: center;"><img src="'.get_attach_path($v['cover'],'album').'" style="margin-right:10px;border-radius: 2px;" width="15" height="20"><span>'.$v['name'].'</span></a></div>';
            }
            $post['authorants'] .= '</div>';
            $return[] = $post['authorants'];
        }
        return $return;
    }

个人资料页的嵌入

class plugin_anthology_home extends plugin_anthology{
    function space_profile_baseinfo_bottom(){
        global $_G;
        $user_authorants = C::t("#anthology#anthology")->fetch_all("`uid` = $_G[gp_uid]","anthology_item","id asc");
        $authorants = '<div class="pbm mbm bbda cl"><h2 class="mbn">Ta的文集</h2><ul class="cl"><li>';
        if($user_authorants){
            foreach($user_authorants as $key=>$v){
                if(count($user_authorants) > '1' && $key > 0){
                    $authorants .= '<span class="pipe">|</span>';    
                }
                $authorants .= '<a href="plugin.php?id=anthology:item&mid='.$v['id'].'" target="_blank">'.$v['name'].'</a>';
            }
        }else{
            $authorants .= '<span class="xg1">暂无文集</span>';
        }
        $authorants .= '</li></ul></div>';
        return $authorants;
    }
}