注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

面包会有的

...

 
 
 

日志

 
 

帝国CMS灵动标签e:loop内部再用sql查询  

2012-08-30 23:08:44|  分类: PHP |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

 

 

 

 

<table width="100%" border="0" cellspacing="1" cellpadding="3">
[e:loop={栏目ID/专题ID,显示条数,操作类型,只显示有标题图片,附加SQL条件,显示排序}]
<tr><td>
<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>
(<?=date('Y-m-d',$bqr[newstime])?>)
</td></tr>
[/e:loop]
</table>

 

实例1:如果信息为当天就加New标志
<ul>
[e:loop={栏目ID,显示条数,操作类型,只显示有标题图片}]
<?
$newimg="";
if(date("m-d",$bqr[truetime]) == date("m-d"))
{
    $newimg = "<img src='New图片地址'>";
}
?>
<li>
<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=sub($bqr[title],0,10,false)?></a><?=$newimg?>
</li>
[/e:loop]
</ul>

 

实例2:在灵动标签内使用SQL
[e:loop={'select * from [!db.pre!]ecms_news where classid=72 and type='开发商' order by id DESC limit 6',6,24,0}]
    <li class="class1"> <a href='http://www.hkqipilang.acafa.com/' target=_blank title='<?=$bqr[title]?>'><?=$bqr[title]?></a>
        <div class="top_div_myAcafa_u"><?=$bqr[address]?><br />业务范围: <?=$bqr[smalltext]?></div>
    </li>
[/e:loop] 

实例3:如果信息带有图片信息,则标题上带有图片标志

[e:loop={'selfinfo',20,0,0}]
<?
$newimg="";
if(!empty($bqr[titlepic]))
{
    $newimg="<img src='http://bbs.zhnews.net/bbs/static/image/filetype/image_s.gif' />";
}
?>
                    <tr class="even">
                        <td class="title">
                            <h1><a href="<?=$bqsr[titleurl]?>" target="_blank"><?=sub($bqr[title],0,24,false)?></a> <?=$newimg?></h1>
                            <p class="intro">
                                <?=$bqr[smalltext]?>[<a title="阅读全文" href="<?=$bqsr[titleurl]?>" target="_blank">详细内容</a>]
                            </p>
                        </td>
                        <td><?=$bqr[myarea]?></td>
                        <td><?=date('Y-m-d H:i:s', $bqr[newstime])?></td>
                    </tr>

[/e:loop]

 

[e:loop={'article',4,20,1}]
      
          <div id="body_left_Panel_Components1_body_No1" class="body_left_Panel_Components1_body_No1">
            <div id="body_left_Panel_Components1_body_No1_img" class="body_left_Panel_Components1_body_No1_img"> <a title="<?=$bqr[title]?>" href="<?=$bqsr[titleurl]?>"> <img height="62" width="115" alt="<?=$bqr[title]?>" src="<?=$bqr[titlepic]?>"/> </a> </div>
            <div id="body_left_Panel_Components1_body_No1_text" class="body_left_Panel_Components1_body_No1_text">
              <ul>
<!--提高Adsense相关度抓取-->
<!-- google_ad_section_start -->                 
                <?php
                       
                        $newimg="";
                        $sql_good=$empire->query("select * from (select a.id,a.title,a.newspath,a.newstime,b.classpath,b.classname,b.filetype from ".$dbtbpre."ecms_article as a,".$dbtbpre."enewsclass b where a.classid=b.classid and a.checked=1 and a.isgood=1 order by a.onclick desc limit 12) as a1 order by length(a1.title)  limit ".($good_pageSize*$good_limitsize).",".$good_limitsize);
                        $_i=$good_limitsize*$good_pageSize+1;
                        while($info=$empire->fetch($sql_good))
                        {
                       
                        ?>
                    <li>
                    <img src="[!--news.url--]face/image/<?=$_i?>.gif" alt="<?=$info[title]?>" width="11" height="9"/><a href="[!--news.url--]<?=$info[classpath].'/'.$info[newspath].'/'.$info[id].$info[filetype ]?>" target="_blank" title="<?=$info[title]?>"><?=sub($info[title],0,20,false)?></a>
                    </li>
             <?php       
                        $_i++;
                        }
                        $good_pageSize++;
                       
                       
                       
                    ?>
<!-- google_ad_section_end -->
              </ul>
            </div>
          </div>
      [/e:loop]

 

 

 

[e:loop={'select classid,classpath,classname from [!db.pre!]enewsclass where classid in ("47","48","49","50","51","52","53","54","55","103","112")  order by classid',1,24,0}]
<div id="body_left_Pane2" class="body_left_Pane2">
    <div id="body_left_Pane2_title" class="body_left_Pane2_title">
        <span><h4><a href="[!--news.url--]<?=$bqr[classpath]?>/" title="<?=$bqr[classname]?>"><?=$bqr[classname]?></a></h4></span>
        <span></span><span></span>
            <?php
                        $newimg="";
                        $sql=$empire->query("select classid,classpath,classname from ".$dbtbpre."enewsclass where bclassid=$bqr[classid]  order by classid");
                        while($info=$empire->fetch($sql))
                        {?>
                                <span><a href="[!--news.url--]<?=$info[classpath]?>/" title="<?=$info[classname]?>"><?=$info[classname]?></a></span>
             <?php
                        }
                    ?>
    </div>
    <div id="body_left_Pane2_body" class="body_left_Pane2_body">
           <div id="body_left_Pane2_body_left" class="body_left_Pane2_body_left">


            <div id="body_left_Pane2_body_left_title" class="body_left_Pane2_body_left_title">
            <?php
                        $newimg="";
                        $sql=$empire->query("select a.*,b.filetype,b.classpath,b.classname from ".$dbtbpre."ecms_article as a,".$dbtbpre."enewsclass b where a.classid=b.classid and a.checked=1 and a.firsttitle=1 and length(a.titlepic)>3 and a.classid in (select classid from ".$dbtbpre."enewsclass where bclassid=$bqr[classid]) order by a.newstime desc limit 1");
                        while($info=$empire->fetch($sql))
                        {?>
                <div id="body_left_Pane2_body_left_title_pic" class="body_left_Pane2_body_left_title_pic">
                    <img src="<?=$info[titlepic]?>" title="<?=$info[title]?>"  width="80" height="60" />
                </div>
                <div id="body_left_Pane2_body_left_title_right" class="body_left_Pane2_body_left_title_right">
                    <h5><a href="[!--news.url--]<?=$info[classpath].'/'.$info[newspath].'/'.$info[id].$info[filetype ]?>" target="_blank" title="<?$info[title]?>"><?=sub($info[title],0,20,false)?></a></h5>
                    <?=sub($info[smalltext],0,100,false)?>……
                </div>
                    <?php
                        }
                    ?>
 
            </div>


            <div id="body_left_Pane2_body_left_body" class="body_left_Pane2_body_left_body">
                <ul>
                       <?php
                        $newimg="";
                        $sql=$empire->query("select a.id,a.title,a.newspath,a.newstime,b.classpath,b.classname,b.filetype from ".$dbtbpre."ecms_article as a,".$dbtbpre."enewsclass b where a.classid=b.classid and a.checked=1 and  a.classid in (select classid from ".$dbtbpre."enewsclass where bclassid='$bqr[classid]'  order by classid)  order by a.onclick desc,a.newstime desc limit ".$limitsize);
                        while($info=$empire->fetch($sql))
                        {
                                                                               if (date("y-m-d",$info[newstime])==date("y-m-d"))
                                                                                 {$newimg="<font color=red>".date("m-d",$info[newstime])."</font>";}
                                                                              else
                                                                                 {$newimg=date("m-d",$info[newstime]);}
                           
                    ?>
                    <li>
                        <a href="[!--news.url--]<?=$info[classpath].'/'.$info[newspath].'/'.$info[id].$info[filetype ]?>" target="_blank" title="<?=$info[title]?>"><?=sub($info[title],0,30,false)?></a>
                    </li>
                    <?php
                        }
                    ?>
                </ul>
            </div>
        </div>
        <div id="body_left_Pane2_body_right" class="body_left_Pane2_body_right">
            <ul>
                       <?php
                        $newimg="";
                        $sql=$empire->query("select a.id,a.title,a.newspath,a.newstime,b.classpath,b.classname,b.filetype,b.classid as b_id from ".$dbtbpre."ecms_article as a,".$dbtbpre."enewsclass b where a.classid=b.classid and a.checked=1 and  a.classid in (select classid from ".$dbtbpre."enewsclass where bclassid='$bqr[classid]'  order by classid)  order by a.newstime desc limit ".$limitNewSize);
                        while($info=$empire->fetch($sql))
                        {
                                                                               if (get_date(date("y-m-d"),date("y-m-d",$info[newstime]))<1)
                                                                                 {$newimg="<img src='[!--news.url--]face/image/new.gif' width='25' height='13'  title='".date("y-m-d",$info[newstime])."'/>";}
                                                                              else
                                                                                 {$newimg="";}
                           
                    ?>
                    <li>
                        <a href="[!--news.url--]<?=$info[classpath]?>/" title="<?=$info[classname]?>">[<?=$info[classname]?>]</a><a href="[!--news.url--]<?=$info[classpath].'/'.$info[newspath].'/'.$info[id].$info[filetype ]?>" target="_blank" title="<?=$info[title]?> 日期:<?=date("Y-m-d",$info[newstime])?>"><?=sub($info[title],0,18,false)?></a><?=$newimg?>
                    </li>
                    <?php
                        }
                    ?>
            </ul>
        </div>
    </div>
</div>
[/e:loop]

 

 

 

  评论这张
 
阅读(3384)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017