在线客服与您一对一交流
当前位置: 主页 > 行业新闻 > IT技术 >

帝国随机调用本栏目下的相关文章

按sql查询 (栏目ID='sql语句') 
数据表前缀可用:“[!db.pre!]"表示 

[e:loop={"select * from phome_ecms_news where classid='$GLOBALS[navclassid]' and title like '%$navinfor[keyboard]%' or keyboard like '%$navinfor[keyboard]%' limit 8",8,24,0}]
 
[e:loop={"select * from phome_ecms_news where classid='$GLOBALS[navclassid]' order by rand() desc limit 8",8,24,0}]
 
[e:loop={栏目ID/专题ID,显示条数,操作类型,只显示有标题图片,附加SQL条件,显示排序}]
模板代码内容
[/e:loop]
 
[e:loop={'selfinfo',10,0,0,"title like '%$navinfor[keyboard]%' or keyboard like '%$navinfor[keyboard]%'"}]
 
[e:loop={'news',10,18,0,"title like '%cms%'",''}]
<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a><br>
[/e:loop]

按表随机调用:  [ecmsinfo]"select * from phome_ecms_news order by rand() desc limit 6 ",6,18,0,24,2,0[/ecmsinfo]
随机调用本栏目:[ecmsinfo]"select * from phome_ecms_news where classid='$GLOBALS[navclassid]' order by rand() desc limit 6",6,18,0,24,2,0[/ecmsinfo]
其中:news为表名,两个6表示调用的数量为6条,18表示标题取18个字符,第一个0表示不显示栏名名,随机调用的操作类型固定为24,2表示模板ID,第二个0标题图片不存在也调用

灵动标签随机调取文章
[e:loop={"select * from {$dbtbpre}ecms_sitenav order by rand() desc limit 6",20,24,0}]
<div class="col-12 col-md-6 col-lg-4">
<div class="ho-hotsitenav">
<em><a href="<?=$bqsr['titleurl']?>" rel="nofollow"><img src="<?=$bqr[titlepic]?>" class="img-fluid" alt="<?=$bqr['title']?>"></a></em>
<span>
<strong><a href="<?=$bqsr['titleurl']?>" rel="nofollow"><?=$bqr['title']?></a></strong>
<p><?=$bqr['smalltext']?></p>
</span>
</div>
</div>
[/e:loop]


标题包含关键字
①、比较粗糙的匹配,可能不太精确:title like '%$navinfor[keyboard]%' 
②、精确的匹配,比较消耗资源:title regexp '(^|,)$navinfor[keyboard]($|,)'
 
关键字相同
①、比较粗糙的匹配,可能不太精确:keyboard like '%$navinfor[keyboard]%'
②、精确的匹配,比较消耗资源:keyboard regexp '(^|,)$navinfor[keyboard]($|,)'
 
 
格式1、
①、模糊匹配
[e:loop={"select *  from phome_ecms_news where title like '%$navinfor[keyboard]%' or keyboard like '%$navinfor[keyboard]%' order by id desc limit 10",0,24,0}]
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br>
[/e:loop]
 
②、精确的匹配
[e:loop={"select *  from phome_ecms_news where title regexp '(^|,)$navinfor[keyboard]($|,)' or keyboard regexp '(^|,)$navinfor[keyboard]($|,)' order by id desc limit 10",0,24,0}]
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br>
[/e:loop]
 
格式2、
①、模糊匹配
[e:loop={'news',10,3,0,"keyboard like '%$navinfor[keyboard]%' or title like '%$navinfor[keyboard]%'",''}]    
   <li>·<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=esub($bqr[title],24)?></a></li> 
[/e:loop]
 
 
[e:loop={0,10,3,0,"keyboard like '%$navinfor[keyboard]%' or title like '%$navinfor[keyboard]%'",''}] 
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br>
[/e:loop]
 
 
注意:在没有相关文章时,会调用最新的文章来替代空缺的位置
 
 
 
 

 


  • 公司:西安蟠龙网络科技有限公司
  • 联系人:张经理
  • 手机/微信:187 2951 9978
  • Q Q: 136 8888 63 点击这里给我发消息
  • 地址:西安市雁塔区唐延南路逸翠园i都会3号楼561