帝国CMS列表页(list.var)判断推荐、头条、置顶,并加(推荐、头条、置顶图)

帝国CMS列表页(list.var)判断推荐、头条、置顶,并加(推荐、头条、置顶图)

添加时间:2021-02-17 01:07:55
说明: 1、首先注意开启置顶:后台 》 系统 》 系统参数设置 》 信息设置 》 信息置顶设置 ,选择 栏目/标签置顶 2、使用的代码 ①、调用几级推荐、头条、置顶 ,如下调用的都是一
举报 举报
收藏
解释:
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

转载请注明: 帝国模板 » 列表页(list.var)判定推荐、头条、置顶,并加(推荐、头条、置顶图)

相关内容推荐
资源求助发帖
查看更多发帖

*

回帖描述:

*

链接类型:

*

下载链接:

密码:
发帖规则:回帖内容为会员之间的私信,普通网友无法查看。
免责声明:回帖中提供的链接内容仅供会员之间学习参考使用,获取内容后请在法律法规范围内使用。回帖提供的内容应符合法律法规要求,不得违反法律法律的要求。
站点权责:回帖内容如违反法律法规,站点有权封停账号使用权利。对用户举报的内容,站点有责任及时删除违规内容。
热点内容推荐
标题:帝国CMS列表页(list.var)判断推荐、头条、置顶,并加(推荐、头条、置顶图)

*

描述:
平均回复时间:3-10分钟
规则介绍:悬赏寻求论坛网友分享资源,站点对分享内容的准确性,合法性,版权等没有足够的监管能力。如果您发现资源不正确,无法使用,不符合法律法律等情况,您可以直接举报资源。站长将尽快核实您的举报,并根据情况,采取封号,退换米粒等处理。

*

回帖描述:

*

链接类型:

*

阅读权限:

*

下载链接:

密码:
发帖规则:回帖内容为会员之间的私信,普通网友无法查看。
免责声明:回帖中提供的链接内容仅供会员之间学习参考使用,获取内容后请在法律法规范围内使用。回帖提供的内容应符合法律法规要求,不得违反法律法律的要求。
站点权责:回帖内容如违反法律法规,站点有权封停账号使用权利。对用户举报的内容,站点有责任及时删除违规内容。
  • 背景波浪
  • 背景波浪
  • 波浪
  • 波浪
客服
在线咨询
周一 至 周日 9:00 ~ 22:00
QQ:1326974360
微信:juyoubuluo6688
客服热线
18205485173
工作日 9:00 ~ 18:00
微信扫码咨询
客户服务
欢迎咨询服务
咨询量较多时,请耐心等待
社群

关注公众号

获取更多资讯

扫码进群(QQ)

与更多大牛交流沟通

0.102152s