迅睿開源框架是一款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ù)咨詢
如何調(diào)用相關(guān)文章10條,如不足10條剩下條數(shù)顯示最新文章?
{module *** return=aa}{/module} {if dr_count($return_aa)<10} 不足10個 {else} 足了正常顯示 {module *** return=aa}{/module} {/if}
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(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)用
測試可行
{module *** return=aa}{/module} {if dr_count($return_aa)<10} 不足10個 {else} 足了正常顯示 {module *** return=aa}{/module} {/if}開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(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ù)
{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)用
測試可行