迅睿開源框架是一款PHP8高性能·簡單易用的PHP開源開發(fā)框架, 基于MIT開源許可協(xié)議發(fā)布,不限制商業(yè)使用,以多端互聯(lián)為設(shè)計理念, 支持的微信公眾號、小程序、APP客戶端、移動端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
業(yè)務(wù)經(jīng)理
微信掃描以上二維碼
028-61286886
技術(shù)咨詢
我的是免費無授權(quán)版本,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作為本頁面的描述
需要看看$tagsql是什么
<?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']; } ?>
再更新一下,修改一下 用這個
需要看看$tagsql是什么
<?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']; } ?>再更新一下,修改一下 用這個