今天是公元: 20250504日 星期   农历: 乙巳初七 2加入收藏 | 设为首页 | 会员中心
您当前的位置:首页 > 科文与生活 > 网站网页

帝国CMS多表联合调用最新和热门信息的方法

日期:2024-06-09   来源:本站整理   点击:63

调用最新或推荐信息:
e:loop={'select * from (
select id,classid,titleurl,filename,title,newstime,titlepic from ec_ecms_photo where newstime union
select id,classid,titleurl,filename,title,newstime,titlepic from ec_ecms_flash where newstime union
select id,classid,titleurl,filename,title,newstime,titlepic from ec_ecms_movie where newstime) a order by newstime desc limit 10',10,24,1}]
//调用推荐信息newstime改为isgood

<?php
//读取栏目id,栏目名称,发表时间(并格式化)
$cid=$bqr['classid'];
$clsname=$class_r[$cid]['classname'];
$ttl=$bqr['title'];
$ntm=date('y-m-d',$bqr['newstime']);

//标题截取指定长度(减去栏目名称的长度)
$tlen=56-strlen($clsname);
$ttl2=substr($ttl, 0,$tlen);
if ( strlen( mb_substr($ttl2, -1,1,"gbk") ) == strlen( substr($ttl2, -1,1) ) ){
  $ttl2=substr($ttl, 0,$tlen -1);
}
?>
<li>[<a href="/List-<?=$cid?>-0.html" target="_blank" ><?=$clsname?></a>] - <a href="<?=$bqsr['titleurl']?>" target="_blank"  title="<?=$ttl?>"><?=$ttl2?></a><span aligh=right><?=$ntm?></span></li>
[/e:loop]

 

调用热门信息:
[e:loop={'select * from (
select id,classid,titleurl,title,onclick from ec_ecms_photo where onclick union
select id,classid,titleurl,title,onclick from ec_ecms_flash where onclick union
select id,classid,titleurl,title,onclick from ec_ecms_movie where onclick) a order by onclick desc limit 10',10,24,0}]

<?php
$i++;
$ttl=$bqr['title'];
$tlen=49;
$ttl2=substr($ttl, 0,$tlen);
if ( strlen( mb_substr($ttl2, -1,1,"gbk") ) == strlen( substr($ttl2, -1,1) ) ){
  $ttl2=substr($ttl, 0,$tlen -1);
}
?>
<li class="no<?=$i?>"><a href="<?=$bqsr['titleurl']?>" target="_blank"  title="<?=$ttl?>"><?=$ttl2?></a></li>
[/e:loop]

上一篇: 帝国CMS首页列表页内容页全站使用动态的设置方法 下一篇: 帝国CMS系统标签e:loop调用的附加SQL条件和排序参数
相关文章
热门文章
  1. replace正则表达式替换前导空格和后导空格
  2. 帝国CMS管理系统必做的安全防护设置
  3. ASCII码控制字符、可显示字符、扩展字符对照表
  4. 常用正则表达式大全
  5. PHP读取TXT类文本内容方法,替换指定内容后再次写入
  6. 帝国CMS多表联合调用最新和热门信息的方法
  7. 帝国ECMS列表模板list.var中新发布的新闻加new标识图
  8. 帝国CMS系统标签e:loop调用的附加SQL条件和排序参数
  9. 帝国CMS COOKIE 及其管理员/会员 登陆信息获取
  10. 帝国cms系统 常用内置字段与调用方法
   关于我们
服务联系
新闻公告
好正好教育
好正好软件(教育管理)
Copyright (c) 2024 好正好教育