列表页(list.var)判断推荐、头条、置顶
发布时间:2021-06-07作者:帝国建站网
说明:
1、首先注意开启置顶:后台 》 系统 》 系统参数设置 》 信息设置 》 信息置顶设置 ,选择 栏目/标签置顶
2、使用的代码
①、调用几级推荐、头条、置顶 ,如下调用的都是一级的推荐、头条、置顶
if(!empty($bqr[titlepic])) //图片
if($bqr[isgood]==1) //推荐
if($r[firsttitle]==1) //头条
if($r[istop]==1) //置顶
if($bqr[isgood]==1&&$bqr[firsttitle]==1&&$bqr[istop]==1) //置顶-头条-推荐 (组合使用)
②、调用全部的推荐、头条、置顶(即:把“==1”修改为“>0”)
if(!empty($bqr[titlepic])) //图片
if($bqr[isgood]>0) //推荐
if($r[firsttitle]>0) //头条
if($r[istop]>0) //置顶
if($bqr[isgood]>0&&$bqr[firsttitle]>0&&$bqr[istop]>0) //置顶-头条-推荐 (组合使用)
---------------------------------------------------------------------------------------------
方法1、判断各自的(有两个或两个以上的属性,也只显示一个属性),即:只显示一个图
注释:如一个信息有“推荐”和“头条”两个属性,下面的代码也只能让其显示一个属性(那个属性在前就先显示那个)
<?=$newimg?>可以是图片 $newimg="<img src='dg2/e/data/images/saypl.gif' />";
举例:
$r[title]=esub($r[title],27,'...');
$newimg="";
if($r[istop]==1)
{
$newimg="<font color=red>[顶]</font>";
}
elseif($r[isgood]==1)
{
$newimg="<font color=red>[荐]</font>";
}
elseif($r[firsttitle]==1)
{
$newimg="<font color=red>[头]</font>";
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】'.$newimg.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
注释:$newimg=""; newimg为空
if($r[istop]==1){$newimg="<font color=red>[顶]</font>"; 当istop=1时,newimg显示“[顶]”
php部分还可以这样写判断 格式:if -> elseif -> else 意思:“判断” 或 “2判读” 否则 “为空”
实际上就是把$newimg=""; 用else放到了最下面
实例:
$r[title]=esub($r[title],27,'...');
if($r[istop]==1)
{
$newimg="<font color=red>[顶]</font>";
}
elseif($r[isgood]==1)
{
$newimg="<font color=red>[荐]</font>";
}
elseif($r[firsttitle]==1)
{
$newimg="<font color=red>[头]</font>";
}
else
{
$newimg="";
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】'.$newimg.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
-------------------------------------------------------------------------------
方法2、判断各自的(有两个或两个以上的属性,可显示多个属性),即:可显示多个图。在上面代码的基础上组合了个“两个的属性”,即:一个信息两张图
注释:如一个信息有“推荐”和“头条”两个属性,在上面的代码基础上加了一个判断的语句把“推荐”和“头条”组合在一起可以显示双属性的属性语句。
即:一条信息同时显示“推荐”和“头条”两个属性
<?=$newimg?>可以是图片 $newimg="<img src='dg2/e/data/images/saypl.gif' />";
举例:
$r[title]=esub($r[title],27,'...');
$newimg="";
if($r[isgood]==1&&$r[firsttitle]==1)
{
$newimg="<font color=red>[推荐]</font> <font color=red>[头条]</font>";
}
elseif($r[isgood]==1)
{
$newimg="<font color=red>[推荐]</font>";
}
elseif($r[firsttitle]==1)
{
$newimg="<font color=red>[头条]</font>";
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】'.$newimg.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
注释:$newimg=""; newimg为空
if($r[istop]==1){$newimg="<font color=red>[顶]</font>"; 当istop=1时,newimg显示“[顶]”
php部分还可以这样写判断 格式:if -> elseif -> else 意思:“判断” 或 “2判读” 否则 “为空”
实际上就是把$newimg=""; 用else放到了最下面
实例:同上
------------------------------------------------------------------------------------------------------------------
方法3、判断各自的,(有两个或两个以上的属性,可显示多个属性),即:可显示多个图。各自加各自的图,即:每个属性上多能加多张图
<?=$newimg?>可以是图片 $newimg="<img src='dg2/e/data/images/saypl.gif' />";
$r[title]=esub($r[title],27,'...');
$newimg="";
$top="";
$good="";
$ttitle="";
if(!empty($r[titlepic]))
{
$newimg="<font color=red>[图片]</font>";
}
if($r[istop]==1)
{
$top = "<font color=red>[置顶]</font>";
}
if($r[isgood]==1)
{
$good = "<font color=red>[推荐]</font>";
}
if($r[firsttitle]==1)
{
$ttitle = "<font color=red>[头条]</font>";
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】 '.$newimg.' '.$top.' '.$good.' '.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
注释:$newimg="";、$top="";、$good="";、$ttitle=""; 各自为空
[titlepic]、[istop]==1、[isgood]==1、[firsttitle]==1 当=1时,各自显示各自的图
php部分还可以这样写判断 格式:if -> else 意思:“判断” 否则 “为空”
实际上就是把$newimg=""; 用else放到了最下面
实例:
$r[title]=esub($r[title],27,'...');
if(!empty($r[titlepic]))
{
$newimg="<font color=red>[图片]</font>";
}
else
{
$newimg='';
}
if($r[istop]==1)
{
$top = "<font color=red>[置顶]</font>";
}
else
{
$top='';
}
if($r[isgood]==1)
{
$good = "<font color=red>[推荐]</font>";
}
else
{
$good='';
}
if($r[firsttitle]==1)
{
$ttitle = "<font color=red>[头条]</font>";
}
else
{
$ttitle='';
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】 '.$newimg.' '.$top.' '.$good.' '.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
---------------------------------------实例-----------------------------------------------
图片、置顶、一级二级推荐、一级二级头条
php部分还可以这样写判断 格式:if -> elseif -> else 意思:“判断” 或 “2判读” 否则 “为空”
实际上就是把$newimg=""; 用else放到了最下面
<br>------------------方法1----------------------<br>
$r[title]=esub($r[title],27,'...');
$newimg="";
$top="";
$good="";
$ttitle="";
if(!empty($r[titlepic]))
{
$newimg="<font color=red>[图片]</font>";
}
if($r[istop]==1)
{
$top = "<font color=red>[置顶]</font>";
}
if($r[isgood]==1)
{
$good = "<font color=red>[推荐]</font>";
}
elseif($r[isgood]==2)
{
$good="<font color=red>[推荐2]</font>";
}
if($r[firsttitle]==1)
{
$ttitle = "<font color=red>[头条]</font>";
}
elseif($r[firsttitle]==2)
{
$ttitle="<font color=red>[头条2]</font>";
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】 '.$newimg.' '.$top.' '.$good.' '.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
方法1:PHP部分的格式:为空 -> if -> elseif
<br>------------------方法2----------------------<br>
$r[title]=esub($r[title],27,'...');
if(!empty($r[titlepic]))
{
$newimg="<font color=red>[图片]</font>";
}
else
{
$newimg='';
}
if($r[istop]==1)
{
$top = "<font color=red>[置顶]</font>";
}
else
{
$top='';
}
if($r[isgood]==1)
{
$good = "<font color=red>[推荐]</font>";
}
elseif($r[isgood]==2)
{
$good="<font color=red>[推荐2]</font>";
}
else
{
$good='';
}
if($r[firsttitle]==1)
{
$ttitle = "<font color=red>[头条]</font>";
}
elseif($r[firsttitle]==2)
{
$ttitle="<font color=red>[头条2]</font>";
}
else
{
$ttitle='';
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】 '.$newimg.' '.$top.' '.$good.' '.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
方法2:PHP部分的格式:if -> elseif -> else
1、首先注意开启置顶:后台 》 系统 》 系统参数设置 》 信息设置 》 信息置顶设置 ,选择 栏目/标签置顶
2、使用的代码
①、调用几级推荐、头条、置顶 ,如下调用的都是一级的推荐、头条、置顶
if(!empty($bqr[titlepic])) //图片
if($bqr[isgood]==1) //推荐
if($r[firsttitle]==1) //头条
if($r[istop]==1) //置顶
if($bqr[isgood]==1&&$bqr[firsttitle]==1&&$bqr[istop]==1) //置顶-头条-推荐 (组合使用)
②、调用全部的推荐、头条、置顶(即:把“==1”修改为“>0”)
if(!empty($bqr[titlepic])) //图片
if($bqr[isgood]>0) //推荐
if($r[firsttitle]>0) //头条
if($r[istop]>0) //置顶
if($bqr[isgood]>0&&$bqr[firsttitle]>0&&$bqr[istop]>0) //置顶-头条-推荐 (组合使用)
---------------------------------------------------------------------------------------------
方法1、判断各自的(有两个或两个以上的属性,也只显示一个属性),即:只显示一个图
注释:如一个信息有“推荐”和“头条”两个属性,下面的代码也只能让其显示一个属性(那个属性在前就先显示那个)
<?=$newimg?>可以是图片 $newimg="<img src='dg2/e/data/images/saypl.gif' />";
举例:
$r[title]=esub($r[title],27,'...');
$newimg="";
if($r[istop]==1)
{
$newimg="<font color=red>[顶]</font>";
}
elseif($r[isgood]==1)
{
$newimg="<font color=red>[荐]</font>";
}
elseif($r[firsttitle]==1)
{
$newimg="<font color=red>[头]</font>";
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】'.$newimg.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
注释:$newimg=""; newimg为空
if($r[istop]==1){$newimg="<font color=red>[顶]</font>"; 当istop=1时,newimg显示“[顶]”
php部分还可以这样写判断 格式:if -> elseif -> else 意思:“判断” 或 “2判读” 否则 “为空”
实际上就是把$newimg=""; 用else放到了最下面
实例:
$r[title]=esub($r[title],27,'...');
if($r[istop]==1)
{
$newimg="<font color=red>[顶]</font>";
}
elseif($r[isgood]==1)
{
$newimg="<font color=red>[荐]</font>";
}
elseif($r[firsttitle]==1)
{
$newimg="<font color=red>[头]</font>";
}
else
{
$newimg="";
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】'.$newimg.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
-------------------------------------------------------------------------------
方法2、判断各自的(有两个或两个以上的属性,可显示多个属性),即:可显示多个图。在上面代码的基础上组合了个“两个的属性”,即:一个信息两张图
注释:如一个信息有“推荐”和“头条”两个属性,在上面的代码基础上加了一个判断的语句把“推荐”和“头条”组合在一起可以显示双属性的属性语句。
即:一条信息同时显示“推荐”和“头条”两个属性
<?=$newimg?>可以是图片 $newimg="<img src='dg2/e/data/images/saypl.gif' />";
举例:
$r[title]=esub($r[title],27,'...');
$newimg="";
if($r[isgood]==1&&$r[firsttitle]==1)
{
$newimg="<font color=red>[推荐]</font> <font color=red>[头条]</font>";
}
elseif($r[isgood]==1)
{
$newimg="<font color=red>[推荐]</font>";
}
elseif($r[firsttitle]==1)
{
$newimg="<font color=red>[头条]</font>";
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】'.$newimg.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
注释:$newimg=""; newimg为空
if($r[istop]==1){$newimg="<font color=red>[顶]</font>"; 当istop=1时,newimg显示“[顶]”
php部分还可以这样写判断 格式:if -> elseif -> else 意思:“判断” 或 “2判读” 否则 “为空”
实际上就是把$newimg=""; 用else放到了最下面
实例:同上
------------------------------------------------------------------------------------------------------------------
方法3、判断各自的,(有两个或两个以上的属性,可显示多个属性),即:可显示多个图。各自加各自的图,即:每个属性上多能加多张图
<?=$newimg?>可以是图片 $newimg="<img src='dg2/e/data/images/saypl.gif' />";
$r[title]=esub($r[title],27,'...');
$newimg="";
$top="";
$good="";
$ttitle="";
if(!empty($r[titlepic]))
{
$newimg="<font color=red>[图片]</font>";
}
if($r[istop]==1)
{
$top = "<font color=red>[置顶]</font>";
}
if($r[isgood]==1)
{
$good = "<font color=red>[推荐]</font>";
}
if($r[firsttitle]==1)
{
$ttitle = "<font color=red>[头条]</font>";
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】 '.$newimg.' '.$top.' '.$good.' '.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
注释:$newimg="";、$top="";、$good="";、$ttitle=""; 各自为空
[titlepic]、[istop]==1、[isgood]==1、[firsttitle]==1 当=1时,各自显示各自的图
php部分还可以这样写判断 格式:if -> else 意思:“判断” 否则 “为空”
实际上就是把$newimg=""; 用else放到了最下面
实例:
$r[title]=esub($r[title],27,'...');
if(!empty($r[titlepic]))
{
$newimg="<font color=red>[图片]</font>";
}
else
{
$newimg='';
}
if($r[istop]==1)
{
$top = "<font color=red>[置顶]</font>";
}
else
{
$top='';
}
if($r[isgood]==1)
{
$good = "<font color=red>[推荐]</font>";
}
else
{
$good='';
}
if($r[firsttitle]==1)
{
$ttitle = "<font color=red>[头条]</font>";
}
else
{
$ttitle='';
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】 '.$newimg.' '.$top.' '.$good.' '.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
---------------------------------------实例-----------------------------------------------
图片、置顶、一级二级推荐、一级二级头条
php部分还可以这样写判断 格式:if -> elseif -> else 意思:“判断” 或 “2判读” 否则 “为空”
实际上就是把$newimg=""; 用else放到了最下面
<br>------------------方法1----------------------<br>
$r[title]=esub($r[title],27,'...');
$newimg="";
$top="";
$good="";
$ttitle="";
if(!empty($r[titlepic]))
{
$newimg="<font color=red>[图片]</font>";
}
if($r[istop]==1)
{
$top = "<font color=red>[置顶]</font>";
}
if($r[isgood]==1)
{
$good = "<font color=red>[推荐]</font>";
}
elseif($r[isgood]==2)
{
$good="<font color=red>[推荐2]</font>";
}
if($r[firsttitle]==1)
{
$ttitle = "<font color=red>[头条]</font>";
}
elseif($r[firsttitle]==2)
{
$ttitle="<font color=red>[头条2]</font>";
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】 '.$newimg.' '.$top.' '.$good.' '.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
方法1:PHP部分的格式:为空 -> if -> elseif
<br>------------------方法2----------------------<br>
$r[title]=esub($r[title],27,'...');
if(!empty($r[titlepic]))
{
$newimg="<font color=red>[图片]</font>";
}
else
{
$newimg='';
}
if($r[istop]==1)
{
$top = "<font color=red>[置顶]</font>";
}
else
{
$top='';
}
if($r[isgood]==1)
{
$good = "<font color=red>[推荐]</font>";
}
elseif($r[isgood]==2)
{
$good="<font color=red>[推荐2]</font>";
}
else
{
$good='';
}
if($r[firsttitle]==1)
{
$ttitle = "<font color=red>[头条]</font>";
}
elseif($r[firsttitle]==2)
{
$ttitle="<font color=red>[头条2]</font>";
}
else
{
$ttitle='';
}
$listtemp='
<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】 '.$newimg.' '.$top.' '.$good.' '.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
方法2:PHP部分的格式:if -> elseif -> else
相关帝国教程
- 10-18帝国CMS使用附加SQL条件灵动标签调用栏目导航
- 04-21帝国cms标签支持按SQL语句调用方法说明
- 03-15帝国CMS会员中心模板改造之调用我提交的信息反馈列表
- 04-28帝国cms时间转化变为几分钟前,几小时前,几天前,几月前,几年前
- 09-23帝国cms验证码说明
- 10-05解决帝国CMS中后台编辑器在IE10下的兼容问题
- 09-17帝国CMS列表页调用关键词带链接
- 06-09帝国cms投票系统使用
- 11-15帝国CMS默认广告JS被屏蔽过滤解决方法
- 07-27phome_enewsgfenip 数据表字段解释(推广插件记录表)
- 05-18帝国CMS多终端手机版内容图片压缩
- 08-24帝国cms信息反馈开启验证码
- 09-27帝国CMS显示指定时间内更新的信息数量
- 10-28帝国cms7.5发送邮件支持465端口的方法
- 12-05帝国CMS 判断文章信息星期几发布
- 05-09帝国CMS正文内容设置关键词与图片链接冲突的问题
- 05-01帝国cms会员中心控制面板不同会员类型出现不同投稿栏目
- 08-28帝国CMS列表页模板随机有规律的插入增加广告流隔行广告
- 12-28帝国CMS SQL标签多表查询
- 04-12帝国CMS内容页模板判断字段为空不显示