在内容页如何调用当前内容页属于哪个专题分类了,其实很简单,代码如下。帝国CMS内容页调用附属专题方法
[e:loop={'select ztid from phome_enewsztinfo where classid='.$navinfor[classid].' and id='.$navinfor[id],10,24,0}]
<a href="/<?=$class_zr[$bqr[ztid]][ztpath]?>"><?=$class_zr[$bqr[ztid]][ztname]?></a>
[/e:loop]
所属专题的缩略图和专题简介:
1、属于单个专题,调用专题名称、专题图片、专题简介、专题关键字
<?php
$zt=$empire->fetch1("select ztid,classid from {$dbtbpre}enewsztinfo where id = '".$navinfor[id]."'");
if($zt[ztid])
{
$ecms_bq_sql2=sys_ReturnEcmsLoopBq("select * from {$dbtbpre}enewszt where ztid={$zt[ztid]} limit 9",9,24,0);
if($bqr2=$empire->fetch($ecms_bq_sql2))
{
$bqsr2=sys_ReturnEcmsLoopStext($bqr2);
?>
专题图片:<img src="<?=sys_ResizeImg($bqr2[ztimg],80,80,1,'')?>"alt="<?=$bqr2[ztname]?>" />
专题名称:<a target="_blank" href="<?=sys_ReturnBqZtname($class_zr[$bqr2[ztid]],9)?>"><?=$class_zr[$bqr2[ztid]][ztname]?></a>
专题关键字:<?=$bqr2[ztpagekey]?>
专题简介:<?=$bqr2[intro]?>
<?php
}
}
?>
2、属于多个专题
<?php $ztsql=$empire->query("select a.*,b.* from {$dbtbpre}enewszt a,{$dbtbpre}enewsztinfo b where a.ztid=b.ztid and b.id='".$navinfor[id]."'");
while($ztr=$empire->fetch($ztsql)){
if($class_zr[$ztr['ztid']]['ztid']==$ztr['ztid']){
$ztname=$class_zr[$ztr['ztid']]['ztname']; //专题名称
$ztlink=sys_ReturnBqZtname($ztr); //专题链接
?>
专题名称<a href="<?=$ztlink?>"><?=$ztname?></a>
专题图片:<img src="<?=sys_ResizeImg($ztr[ztimg],80,80,1,'')?>"alt="<?=$ztr[ztname]?>" />
专题关键字:<?=$ztr[ztpagekey]?>
专题简介:<?=$ztr[intro]?>
<?php
}
}
?>
3、专题下的其他信息:
<div class="ulBox">
<?php
$ztsql = $empire->query("select a.*,b.* from {$dbtbpre}enewszt a,{$dbtbpre}enewsztinfo b where a.ztid=b.ztid and b.id='".$navinfor[id]."'");
$bqno = 0;
while ($ztr = $empire->fetch($ztsql)) {
if ($class_zr[$ztr['ztid']]['ztid'] == $ztr['ztid']) {
$ztname = $class_zr[$ztr['ztid']]['ztname']; //专题名称
$ztlink = sys_ReturnBqZtname($ztr); //专题链接
$bqno++;
?>
<?php
if ($bqno == 1) { //指定第一条信息
$class = ""; //第一条信息的样式
} else { //其它信息
$class = "hide"; //其它信息的样式
}
?>
<div class="<?=$class?>">
<div class="top">
<a href="<?=$ztlink?>" title="<?=$ztname?>" target="_blank" class="imgBox">
<img src="<?=sys_ResizeImg($ztr[ztimg], 80, 80, 1, '')?>" alt="<?=$ztname?>">
<span>共收录<?=$ztr[ztnum]?>款</span>
</a>
<p><?=$ztname?></p>
<span><?=date("Y-m-d", $ztr['addtime'])?></span>
<div>
<p><?=$ztr[intro]?></p>
<a href="<?=$ztlink?>" target="_blank" title="">查看详情<i class="icon"></i></a>
</div>
</div>
<ul>
<?php
$v = $ztr['ztid'];
?>
<?php
$ecms_bq_sql2=sys_ReturnEcmsLoopBq("select id,ztid,classid from [!db.pre!]enewsztinfo where ztid='$v' limit 10",0,24,0);
$bqno2=0;
while($bqr2=$empire->fetch($ecms_bq_sql2))
{
$id=($bqr2[id]);
$bqno2++;
?>
<?php
$ecms_bq_sql3=sys_ReturnEcmsLoopBq("select titleurl,title,classid,titlepic from {$dbtbpre}ecms_{$class_r[$bqr2[classid]][tbname]} where id={$bqr2[id]}",0,24,0);
$bqno3=0;
while($bqr3=$empire->fetch($ecms_bq_sql3))
{
$bqsr3=sys_ReturnEcmsLoopStext($bqr3);
$bqno3++;
?>
<li>
<a href="<?=$bqr3[titleurl]?>" target="_blank" title="<?=$bqr3[title]?>">
<img data-src="<?=$bqr3[titlepic]?>" src="" alt="<?=$bqr3[title]?>">
<p><?=$bqr3[title]?></p>
<p><?=$bqr3[classname]?></p>
<div >下载</div>
</a>
</li>
<?php
}
?>
<?php
}
?>
</ul>
</div>
<?php
}
}
?>
<?php
$ecms_bq_sql = sys_ReturnEcmsLoopBq("select addtime,ztid,ztnum,ztimg,ztpath,ztname,intro from [!db.pre!]enewszt where ztname like '%$classname1%' limit 4", 0, 24, 0);
$bqno = 0;
while ($bqr = $empire->fetch($ecms_bq_sql)) {
$ztid = ($bqr[ztid]);
$bqno++;
?>
<?php
if ($bqno == 1) { //指定第一条信息
$class = ""; //第一条信息的样式
} else { //其它信息
$class = "hide"; //其它信息的样式
}
?>
<div class="<?=$class?>">
<div class="top">
<a href="/<?=$bqr['ztpath']?>/" title="<?=$bqr['ztname']?>" target="_blank" class="imgBox">
<img src="<?=$bqr['ztimg']?>" alt="<?=$bqr['ztname']?>"/>
<span>共收录<?$num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsztinfo where ztid='$bqr[ztid]'");
echo $num;?>款</span>
</a>
<p><?=$bqr['ztname']?></p>
<span><?=date("Y-m-d", $bqr['addtime'])?></span>
<div>
<p><?=$bqr['intro']?></p>
<a href="/<?=$bqr['ztpath']?>/" target="_blank" title="">查看详情<i class="icon"></i></a>
</div>
</div>
<ul>
<?php
$ecms_bq_sql2 = sys_ReturnEcmsLoopBq("select id,ztid,classid from [!db.pre!]enewsztinfo where ztid='$ztid' limit 10", 0, 24, 0);
$bqno2 = 0;
while ($bqr2 = $empire->fetch($ecms_bq_sql2)) {
$id = ($bqr2[id]);
$bqno2++;
?>
<?php
$ecms_bq_sql3 = sys_ReturnEcmsLoopBq("select titleurl,title,classid,titlepic from {$dbtbpre}ecms_{$class_r[$bqr2[classid]][tbname]} where id={$bqr2[id]}", 0, 24, 0);
$bqno3 = 0;
while ($bqr3 = $empire->fetch($ecms_bq_sql3)) {
$bqsr3 = sys_ReturnEcmsLoopStext($bqr3);
$bqno3++;
?>
<li>
<a href="<?=$bqr3[titleurl]?>" target="_blank" title="<?=$bqr3[title]?>">
<img data-src="<?=$bqr3[titlepic]?>" src="" alt="<?=$bqr3[title]?>">
<p><?=$bqr3[title]?></p>
<p><?=$bqr3[classname]?></p>
<div >下载</div>
</a>
</li>
<?php
}
?>
<?php
}
?>
</ul>
</div>
<?php
}
?>
</div>
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)