迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發(fā)框架,基于MIT開源許可協(xié)議發(fā)布,免費(fèi)且不限制商業(yè)使用,是免費(fèi)開源的產(chǎn)品,以萬端互聯(lián)為設(shè)計理念,支持的微信公眾號、小程序、APP客戶端、移動端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
聯(lián)系官方銷售客服
1835022288
028-61286886
如何調(diào)用相關(guān)文章10條,如不足10條剩下條數(shù)顯示最新文章?
{module *** return=aa}{/module} {if dr_count($return_aa)<10} 不足10個 {else} 足了正常顯示 {module *** return=aa}{/module} {/if}
回復(fù)@外聘專員-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}
不足條數(shù)用最新文章籌夠10條
{/module}
{else}
{module module=article catid=6 LIKE_title=$parent.name return=aa}
有10條直接顯示
{/if}
以上測試不正確。感謝回復(fù)想要的效果是:相關(guān)文章1相關(guān)文章2最新1.....8條(相關(guān)只有2條。剩下8條顯示最新)相關(guān)文章1相關(guān)文章2相關(guān)文章3......10
查推薦10條,計算結(jié)果數(shù),不夠的,在用最新的查對應(yīng)條數(shù)
{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} 不足條數(shù)用最新文章籌夠10條 {/module} {/if}
獲得相關(guān)文章的數(shù)量,然后高于10的話,不調(diào)用
測試可行
回復(fù)@外聘專員-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}
不足條數(shù)用最新文章籌夠10條
{/module}
{else}
{module module=article catid=6 LIKE_title=$parent.name return=aa}
有10條直接顯示
{/module}
{/if}
以上測試不正確。感謝回復(fù)
想要的效果是:
相關(guān)文章1
相關(guān)文章2
最新1.....8條(相關(guān)只有2條。剩下8條顯示最新)
相關(guān)文章1
相關(guān)文章2
相關(guān)文章3......10
查推薦10條,計算結(jié)果數(shù),不夠的,在用最新的查對應(yīng)條數(shù)
獲得相關(guān)文章的數(shù)量,然后高于10的話,不調(diào)用
測試可行