业务经理

微信扫描以上二维码

028-61286886

技术咨询

怎么把tag文章列表的最旧的一条信息的description作为页面描述

开源系统 更新 2018-11-20 11:49:19 zhuroufanzi

我的是免费无授权版本,3.2.

以下是tag模板获取文章列表的代码:

{list action=sql sql='$tagsql' module=$dirname page=1 urlrule=$urlrule pagesize=15 order=updatetime} 

     {$t.title}{dr_strcut($t.description,85)}       

{/list}

问题:怎么把tag所获取的文章列表中最旧的一条信息的description作为本页面的描述

方案

  • Amour #1 · 2018-11-20 10:34:48
    需要看看$tagsql是什么
  • 夏正松 #2 · 2018-11-20 11:27:51
    <?php 
        $meta = $ci->db->select('description,title')->where('status',9)->where($ci->db->like('title', $tag, 'both')->or_like('title', $tag, 'both'))->limit(1)->order_by('updatetime ASC')->get(SITE_ID.'_'.$dirname)->row_array();
        $meta_description = $meta['description'];
    ?>


    以上代码 放到 模板的 最最最上面,也就是第一行,试试看

  • 夏正松 #3 · 2018-11-20 11:31:15
    <?php
        if($tag && $dirname){
            $meta = $ci->db->select('description,title')->where('status',9)->where($ci->db->like('title', $tag, 'both')->or_like('title', $tag, 'both'))->limit(1)->order_by('updatetime ASC')->get(SITE_ID.'_'.$dirname)->row_array();
            $meta_description = $meta['description'];
        }
    ?>
    更新一下,加个判断
  • 夏正松 #4 · 2018-11-20 11:33:06
    满意答案
    <?php
        if($tag && $dirname){
            $meta = $ci->db->select('description,title')->where('status',9)->where($ci->db->like('title', $tag, 'both')->or_like('keywords', $tag, 'both'))->limit(1)->order_by('updatetime ASC')->get(SITE_ID.'_'.$dirname)->row_array();
            $meta_description = $meta['description'];
        }
    ?>
    再更新一下,修改一下 用这个
  • zhuroufanzi #5 · 2018-11-20 11:49:19
    技术过硬,完美解决了问题!

迅睿系统漏洞

GEO系统
GEO系统(2026-09-15)
运营客户端,防止误触阴影处关闭对话框
独立站群系统
独立站群系统(2026-09-14)
子站独立部署时修复同步附件失败问题
在线客服
在线客服(2026-09-13)
修复删除会话报错问题 删除会话时联动删除聊天图片
在线考试竞赛系统
在线考试竞赛系统(2026-09-12)
增加投票功能 考试功能拓展 注意:更新后需要执行系统更新,更新数...
网上信箱
网上信箱(2026-09-12)
修复新版本兼容问题
GeoSeo收录宝
GeoSeo收录宝(2026-09-12)
1 优化Update.php文件,解决版本在线升级不完整问题 2 ...
GeoSeo工具箱
GeoSeo工具箱(2026-09-11)
修正历史记录推送
微信系统
微信系统(2026-09-11)
增加数据统计总览界面 账号管理增加服务和公众号的区别 菜单管理支持更...
答题系统
答题系统(2026-09-11)
一站式在线答题系统,支持真题考试、题库练习和错题本,适合培训、考证、...
阿里云滑动验证码
阿里云滑动验证码(2026-09-10)
采用阿里云验证码替换迅睿系统自带的图片验证码和滑动验证码。后台设置方...