迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發框架,基于MIT開源許可協議發布,免費且不限制商業使用,是免費開源的產品,以萬端互聯為設計理念,支持的微信公眾號、小程序、APP客戶端、移動端網站、PC網站等多終端式管理系統。
聯系官方銷售客服
1835022288
028-61286886
如何調用相關文章10條,如不足10條剩下條數顯示最新文章?
{module *** return=aa}{/module} {if dr_count($return_aa)<10} 不足10個 {else} 足了正常顯示 {module *** return=aa}{/module} {/if}
回復@外聘專員-GOLANG工作室
{module module=article catid=6 LIKE_title=$parent.name return=aa}{/module}
{if dr_count($return_aa)<10}
{module module=news catid=6 order=rand cache=3600}
不足條數用最新文章籌夠10條
{/module}
{else}
{module module=article catid=6 LIKE_title=$parent.name return=aa}
有10條直接顯示
{/if}
以上測試不正確。感謝回復想要的效果是:相關文章1相關文章2最新1.....8條(相關只有2條。剩下8條顯示最新)相關文章1相關文章2相關文章3......10
查推薦10條,計算結果數,不夠的,在用最新的查對應條數
{module *** num=10 return=aa} {/module} {if dr_count($return_aa)<10} <?php $_t_end=10-dr_count($return_aa); ?> {module *** num=1,$_t_end return=aa} {/module} {/if}
{module module=news LIKE_title=$parent.name num=10 return=aa}<p>{$aa.title}</p>{/module} {php $all = dr_count($return_aa); $num = 10 - $all; } {if $num >0} {module module=news num=$num order=rand cache=3600} 不足條數用最新文章籌夠10條 {/module} {/if}
獲得相關文章的數量,然后高于10的話,不調用
測試可行
回復@外聘專員-GOLANG工作室
{module module=article catid=6 LIKE_title=$parent.name return=aa}{/module}
{if dr_count($return_aa)<10}
{module module=news catid=6 order=rand cache=3600}
不足條數用最新文章籌夠10條
{/module}
{else}
{module module=article catid=6 LIKE_title=$parent.name return=aa}
有10條直接顯示
{/module}
{/if}
以上測試不正確。感謝回復
想要的效果是:
相關文章1
相關文章2
最新1.....8條(相關只有2條。剩下8條顯示最新)
相關文章1
相關文章2
相關文章3......10
查推薦10條,計算結果數,不夠的,在用最新的查對應條數
獲得相關文章的數量,然后高于10的話,不調用
測試可行