帝国cms公共模板变量标签评论

公共模板变量标签评论

公共模板变量标签评论








关于调用评论的方法:
1、首页调用最新评论4条[参考]


[e:loop={"select * from {$dbtbpre}enewspl_1 where saytext not like '%ecomment%' order by saytime DESC limit 4",0,24,0}]
fetch1("select userpic from {$dbtbpre}enewsmemberadd where userid='$myid'");
$picnum=intval(mt_rand(1,7));
for($i=0;$i
  • <img src="" alt="">

  • [/e:loop]

    还没结束,为了让首页调用的评论也能以“刚刚”、“几分钟前”来显示时间,需要将插件list.php中的以下代码剪切并粘贴至e/class/userfun.php(注意是剪切不是复制):

    
    function lgy_tranTime($time) {
    $minute = date("H:i",$time);
    $hour = date("H:i",$time);
    $alltime = date("Y年m月d日 H:i",$time);
    $time = time() - $time;
    if ($time < 60) {
    $str = ' 刚刚 ';
    }
    elseif ($time < 60 * 60) {
    $min = floor($time/60);
    $str = $min.'分钟前 ';
    }
    elseif ($time < 60 * 60 * 24) {
    $h = floor($time/(60*60));
    $str = $h.'小时前 ';
    }
    elseif ($time < 60 * 60 * 24 * 3) {
    $d = floor($time/(60*60*24));
    if($d=1)
       $str = '昨天 '.$minute;
    else
       $str = $alltime;
    }
        else {
    $str = $alltime;
    }
    return $str;
    }

    发表回复

    您的邮箱地址不会被公开。 必填项已用 * 标注