<?=dpGetKeyboard(200)?> 这个怎么来限制调用出来的标题字数

发布时间:2019-10-12 18:22:03

=dp_GetKeyboard(200)这个怎么来限制调用出来的标题字数,比如我想限制调用出来的标题为60个字符,谢谢!

您的位置:仿站网 > 问答 >
<?=dp_GetKeyboard(200)?>  这个怎么来限制调用出来的标题字数,比如我想限制调用出来的标题为60个字符,谢谢!
回复列表
1.
你这是自定义函数,看函数里有没有截取字数
2.
这样子试一下呢  
<?=esub(dp_GetKeyboard(200),60)?>
3.
原帖由 wohui99 于 2019-08-06 14:38:48 发表
这样子试一下呢  
<?=esub(dp_GetKeyboard(200),60)?>

调用不出标题来,只调用出了链接地址
4.
原帖由 zhxin 于 2019-08-06 13:25:44 发表
你这是自定义函数,看函数里有没有截取字数


麻烦看看这里面有吗?

function dp_GetKeyboard($num=200){
        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;
}
5.
后台--公共模板--相关信息链接模板 截取字数
6.
原帖由 095hjg 于 2019-08-06 19:31:13 发表
后台--公共模板--相关信息链接模板 截取字数



果然如此,谢谢!
相关问题

仿站网专注于帝国CMS仿站及二次开发、模板定制等各种有关帝国CMS程序疑难杂症!
Copyright@2016-2023 汇鑫网络工作室 版权所有 仿站网 www.ecmsw.cn
鲁ICP备17005488号-1 鲁公网安备 37018102000481号