迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架,基于MIT开源许可协议发布,免费且不限制商业使用,是免费开源的产品,以万端互联为设计理念,支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
我的是免费无授权版本,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作为本页面的描述
<?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']; ?>
以上代码 放到 模板的 最最最上面,也就是第一行,试试看
<?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']; } ?>
<?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']; } ?>
以上代码 放到 模板的 最最最上面,也就是第一行,试试看