您现在的位置是:首页 > cms教程 > 帝国CMS教程帝国CMS教程

帝国cms列表页(list.var)判断推荐头条置顶并附加图标的方法

君菁2023-01-22帝国CMS教程已有人查阅

导读首先注意开启置顶:后台 》 系统 》 系统参数设置 》 信息设置 》 信息置顶设置 ,选择 栏目/标签置顶

说明:
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> &nbsp;<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--]】&nbsp;'.$newimg.' &nbsp;'.$top.'&nbsp;'.$good.'&nbsp;'.$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--]】&nbsp;'.$newimg.' &nbsp;'.$top.'&nbsp;'.$good.'&nbsp;'.$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--]】&nbsp;'.$newimg.' &nbsp;'.$top.'&nbsp;'.$good.'&nbsp;'.$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--]】&nbsp;'.$newimg.' &nbsp;'.$top.'&nbsp;'.$good.'&nbsp;'.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>
';
方法2:PHP部分的格式:if -> elseif -> else

本文标签:

很赞哦! ()

相关源码

  • (自适应)调节阀门气动球阀控制阀网站模板源码下载为调节阀门、气动球阀等工业设备企业打造的响应式网站模板,基于PbootCMS系统开发。突出产品参数展示与技术文档管理功能,通过专业化的布局设计有效呈现工业设备特性,适配各类终端访问需求。查看源码
  • (自适应)水墨风中药馆中医名医介绍pbootcms网站模板本模板基于PbootCMS内核开发,为中医馆、中医药企业量身定制,可快速搭建具有传统文化特色的官方网站。自适应手机端设计,数据实时同步,助您高效展示中医特色诊疗、中药产品、养生知识等内容,塑造专业品牌形象。查看源码
  • (PC+WAP)蓝色不锈钢簧线金属制品营销型pbootcms网站模板本模板基于PbootCMS内核开发,为不锈钢及金属制品企业量身打造。采用响应式设计,适配PC与移动设备,提供统一后台管理体验,数据实时同步更新。查看源码
  • 帝国cms7.5商城模板带图片视频广告位功能本模板基于帝国CMS7.5内核开发,为内容电商平台设计,集成文章、图片、视频多媒体展示与广告位管理功能。采用智能响应式技术,确保商品内容在不同设备上获得较优呈现效果,帮助快速构建专业的内容营销平台。查看源码
  • 帝国CMS7.5小说推荐公众号导航带wap手机站+带采集工具本模板为小说导航类网站设计开发,基于帝国CMS7.5内核构建,针对小说阅读领域的分类聚合需求进行深度优化。通过智能分类系统和用户行为分析,实现小说资源的精准推荐与导航功能。查看源码
  • pbootcms模板(PC+WAP)传媒广告影视公司网站源码基于PbootCMS内核开发的全自适应传媒文化网站模板,为影视公司、广告传媒企业打造,同时支持多行业快速适配。通过替换文字图片即可转换为其他行业网站查看源码
分享笔记 (共有 篇笔记)
验证码: