• 函数代码:
    function dp_GetKeyboard($num=100) {
        global $empire, $public_r, $class_r, $fun_r, $dbtbpre, $class_r, $navinfor;
        $keyid = $navinfor['keyid'];
        $classid = $navinfor['classid'];
        $id = $navinfor['id'];
        $link_num = $class_r[$classid]['link_num'];
        if (!$link_num) {
            return $fun_r['NotLinkNews'];
        }
        $tr = $empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1");
        $temp_r = explode("[!--empirenews.listtemp--]", $tr[otherlinktemp]);
        if ($keyid) {
            $add = "id in (".$keyid.")";
        } else {
            $e = $id + $num;
            $s = $id - $num;
            $add = " classid=".$classid." and id>".$s." and id<".$e;
        }
        $key_sql = $empire->query("select id, newstime, title, isurl, titleurl, classid, titlepic from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add." order by newstime desc limit $link_num");
        while ($link_r = $empire->fetch($key_sql)) {
            if ($link_r['id'] == $id) {
                continue;
            }
            $keyboardtext .= RepOtherTemp($temp_r[1], $link_r, $tr);
        }
        if (empty($keyboardtext)) {
            return $fun_r['NotLinkNews'];
        }
        $keyboardtext = $temp_r[0].$keyboardtext.$temp_r[2];
        return $keyboardtext;
    }
  • 调用方法:
     
     
    <?=dp_GetKeyboard(200)?>