帝国cms常用标签汇总
author:一佰互联 2019-04-28   click:724

判断会员是否登录

<?phpif(!$_COOKIE[ecmsmlusername]){$srr="登录可见";}else{$srr="[!--lbsly--]";}?>
[!--news.url--]skin/default/[e:loop={"select classid,classname,bname from phome_enewsclass where classid="$GLOBALS[navclassid]"",1,24,0}]<title><?=$bqr[bname]?></title>[/e:loop][e:loop={"select * from phome_enewsclass where classid="$GLOBALS[navclassid]"",1,24,0}]<title><?=$bqr[bname]?></title>[/e:loop]<?php$fcr=explode("|",$class_r[$GLOBALS[navclassid]][featherclass]);$topbclassid=$fcr[1]?$fcr[1]:$GLOBALS[navclassid];//取得当前栏目的顶级栏目ID$rs=$empire->fetch1("select * from phome_enewsclass where classid=$topbclassid");?>_<?=$rs["bname"]?>_<?=$public_r[sitename]?> 顶级栏目名称+网站标题<?=$class_r[$GLOBALS[navclassid]][bname]?> 得到当前栏目的名称<title>[!--pagetitle--] </title> 或  <title><?=$class_r[$GLOBALS[navclassid]][bname]?></title><meta name="keywords" content="[!--pagekey--]" /><meta name="description" content="[!--pagedes--]" />
isgood=1 一级推荐firsttitle=1 一级头条[e:loop={10,3,0,0}] 10当前栏目,3显示条数,[e:loop={4,1000,0,1,"leib="楼市快讯"","id DESC"}] 1有图片的显示。[e:loop={"select * from phome_ecms_xtgg where firsttitle=1 order by id DESC limit 20",6,24,0}]<?=$bqno?> [!--no.num--] 循环序号<?=$bqsr["titleurl"]?> <?=$bqr[title]?> <?=esub($bqr[title],8)?>[/e:loop]

<?=DoWapRepNewstext($r[newstext])?>

时间调用标签:<?=date("Y-m-d",$bqr["newstime"])?>

列表页

您当前的位置:[!--newsnav--]

[!--no.num--]

[!--show.listpage--]

内容页

[!--info.next--]下一篇 [!--info.pre--]上一篇

万能标签用[!--onclick--] 灵动标签用<?=$bqr[onclick]?> 点击量

复制代码 代码如下:$titleurl=sys_ReturnBqTitleLink($navinfor); 获得当前页面的网址$url = "http://".$_SERVER ["HTTP_HOST"].$_SERVER["PHP_SELF"]; 获得当前页面的网址

sql语句

复制代码 代码如下:<?php //报名人数 $num=$empire->gettotal("select count(*) as total from phome_enewsfeedback where kft="".$navinfor[title].""");?>

帝国CMS经常用到的调用sql语句:

请注意,如果是帝国7.0版本的,需要将checked=1去掉

复制代码 代码如下:  1,根据最新文章 select * from [!db.pre!]ecms_news where checked=1 order by newstime desc limit 10  2,根据推荐文章 select * from [!db.pre!]ecms_news where checked=1 and isgood=1 order by newstime desc limit 10  3,根据热门文章 select * from [!db.pre!]ecms_news where checked=1 order by onclick desc limit 10  4,根据头条新闻 select * from [!db.pre!]ecms_news where checked=1 and firsttitle=1 order by newstime desc limit 10  5,根据评论排行 select * from [!db.pre!]ecms_news where checked=1 order by plnum desc limit 10  6,根据digg排行 select * from [!db.pre!]ecms_news where checked=1 order by diggtop desc limit 10  7,根据投票排行 select * from [!db.pre!]ecms_news where checked=1 order by votenum desc limit 10  8,根据下载排行 select * from [!db.pre!]ecms_news where checked=1 order by totaldown desc limit 10  9,根据评分排行 select * from [!db.pre!]ecms_news where checked=1 order by infopfen desc limit 10

小技巧收录:

php三元条件运算符:

复制代码 代码如下:<?=$bqr["ftitle"]?$bqr["ftitle"]:$bqr["title"]?>

灵动或者php查询调用编辑器内容的时候要加stripslashes删除反斜杠比如:

复制代码 代码如下:<?=stripslashes($r["newstext"])?>

内容页当前信息ID:

复制代码 代码如下:$navinfor["id"]

列表内容模板信息ID:

复制代码 代码如下:$r["id"]

当前栏目名:

复制代码 代码如下:$class_r[$GLOBALS["navclassid"]]["classname"];

当前栏目父栏目:

复制代码 代码如下:$class_r[$GLOBALS["navclassid"]]["bclassid"];

当前栏目别名:

复制代码 代码如下:$class_r[$GLOBALS["navclassid"]]["bname"];

当前栏目子栏目:

复制代码 代码如下:$class_r[$GLOBALS["navclassid"]]["sonclass"];

当前栏目子判断是否为终级栏目:

复制代码 代码如下:$class_r[$GLOBALS["navclassid"]]["islast"];

当前栏目是否有已审核信息:

复制代码 代码如下:$GLOBALS["num"]==0为没有信息

帝国cms中引入php路径写法(例子是文件在根目录)

复制代码 代码如下:<?php include(ECMS_PATH."./bottom.php");?>

排除置顶、头条、推荐等,sql附加条件:

复制代码 代码如下:"istop=0 and isgood=0 and firsttitle=0"

上上级栏目id:

<?php$bclassid=$class_r[$GLOBALS[navclassid]][bclassid];$bbclassid=$class_r[$bclassid][bclassid];echo $bbclassid;?>$bbclassid就是上上级父栏目id

投稿、登陆、反馈、留言等之后跳转指定页面:

复制代码 代码如下:<input type=hidden name=ecmsfrom value="返回页面地址">

统计信息被收藏数:

复制代码 代码如下:<?$favas=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsfava where id="$navinfor[id]" and classid="$GLOBALS[navclassid]"");?><?=$favas?>就是这条信息的收藏数

列表、结合项判断当前没有信息给出提示:

<?if($GLOBALS["num"]=="0"){?><p>对不起,暂时没有任何信息!</p><?}else{?>[!--empirenews.listtemp--]<!--list.var1-->[!--empirenews.listtemp--]<?}?>[/code]

动态使用:

网站名称:<?=$public_r["sitename"]?>网站地址:<?=$public_r["newsurl"]?>

帝国自身的时间转换函数:

复制代码 代码如下:<?=format_datetime($bqr[newstime],"Y-m-d")?>

此函数自带判断,比较不错,推荐。

判断内容是否有图片,没有图片则显示文中广告 有图片则不显示:

复制代码 代码如下:<?php$string=$navinfor["newstext"];//内容字段$some="<img ";$num=explode($some,$string);if(count($num)>1){//判断内容中是否有图片?>[!--newstext--]<?}else{?><div id="ad">我是广告</div>[!--newstext--]<?}?>

截取加过滤标签:

复制代码 代码如下:<?=esub(htmlspecialchars(strip_tags($navinfor[newstext])),160)?>

内容页或灵动标签支持标题属性内容页:

复制代码 代码如下:<?=DoTitleFont($navinfor[titlefont],$navinfor[title])?>

灵动标签:

复制代码 代码如下:<?=DoTitleFont($bqr[titlefont],$bqr[title])?>

标题截取字数+标题属性:

复制代码 代码如下:<?=DoTitleFont($bqr[titlefont],esub($bqr[title],32,"..."))?>

以上所述就是本文的全部内容了,希望大家能够喜欢。