请问易优CMS如何获取广告数量(图文)
在仿站的过程中,有时需要调用广告组内的广告数量,可是又没有相对应的标签,如何解决呢? 使用下面方法即可完美解决; 打开 \extend\function.php 文件,复制下面代码粘贴进去 // 获取广告组内广告的数量 if (!function_exists('diy_adv_total')) { function diy_adv_total($pid = 0) { $total = 0; $pid = intval($pid); if (!empty($pid)) { $where = [ 'pid' => $pid, 'status' => 1, 'is_del' => 0, 'lang' => get_home_lang(), ]; $total = \think\Db::name('ad')->where($where)->count(); } echo intval($total); } } 前端模板调用标签:{eyou:php}diy_adv_total(1);{/eyou:php} 此广告组的广告是三个,那么标签调用的值即为3;
更新时间:2025-04-11 00:59:56
转载请注明原文链接:https://www.muzicopy.com/suibi/6964.html