| 插件名稱 | API接口 V7.8 |
| 插件作者 | 迅睿官方團隊 |
| 最近更新 | 2025-03-06 07:21:54 |
| 支持對達夢數(shù)據(jù)庫的驅(qū)動 |
內(nèi)容頁關聯(lián)文章標簽related接口調(diào)用不顯示?
{if $tag}
{related module=news field=title,inputtime,support,hits,thumb,catid,uid tag=$tag page=1 pagesize=10 urlrule=$urlrule return=r}
{php $api['thumb'] = dr_thumb($c, 260, 195, 0, 'crop');}
{php $api['support'] = intval($r['support']);}
{php $api['title'] = $r['title'];}
{php $api['hits'] = intval($r['hits']);}
{php $api['comments'] = dr_cat_value('works', $r['catid'], 'name');}
{php $api['inputtime'] = dr_fdate($r['_inputtime']);}
{/related}
{/if}
開源是一種精神,但不是義務,幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復@官方插件技術-胡老師 辛苦了,這么晚還沒休息 ??
這是內(nèi)容頁,沒有[$key],研究了半天,
現(xiàn)在調(diào)用出來后沒有循環(huán),求教
{php $api['tag'] = $tag;} {php $api['relatedlist'] = [];} {related module=works field=title,support,thumb,upworks,uid tag=$tag page=1 pagesize=10 return=r} {php $api['relatedlist']['id'] = $r['id'];} {php $api['relatedlist']['author'] = dr_member_info($r['uid'])['name'];} {php $api['relatedlist']['thumb'] = dr_thumb($r['thumb'], 260, 195, 0, 'crop');} {php $api['relatedlist']['title'] = $r['title'];} {php $api['relatedlist']['updatetime'] = dr_date($r['updatetime']);} {php $api['relatedlist']['description'] = dr_strcut($r['description'], 100, '...');} {php $api['relatedlist']['user_avatar'] = dr_avatar($r['uid']);} {php $api['relatedlist']['support'] = intval($r['support']);} {php $api['relatedlist']['comments'] = $r['comments'];} {/related} {php $api['relatedlist']['total'] = $total;} {php $api['relatedlist']['nums'] = $nums;} {php $api['relatedlist']['page'] = $page;} {php $api['relatedlist']['pagesize'] = $pagesize;}回復@likeren
回復@官方插件技術-胡老師

回復@GoWorkRoom
{php $api['tag'] = $tag;}是這個嗎?
{if $tag} {related module=news field=title,inputtime,support,hits,thumb,catid,uid tag=$tag page=1 pagesize=10 urlrule=$urlrule return=r} {php $api[$key_r]['thumb'] = dr_thumb($c, 260, 195, 0, 'crop');} {php $api[$key_r]['support'] = intval($r['support']);} {php $api[$key_r]['title'] = $r['title'];} {php $api[$key_r]['hits'] = intval($r['hits']);} {php $api[$key_r]['comments'] = dr_cat_value('works', $r['catid'], 'name');} {php $api[$key_r]['inputtime'] = dr_fdate($r['_inputtime']);} {/related} {/if}{php $api['tag'] = $tag;}
{php $api['relatedlist'] = [];}
{related module=works field=title,support,thumb,upworks,uid tag=$tag page=1 pagesize=10 return=r}
{php $api['relatedlist'][$key]['id'] = $r['id'];}
{php $api['relatedlist'][$key]['author'] = dr_member_info($r['uid'])['name'];}
{php $api['relatedlist'][$key]['thumb'] = dr_thumb($r['thumb'], 260, 195, 0, 'crop');}
{php $api['relatedlist'][$key]['title'] = $r['title'];}
{php $api['relatedlist'][$key]['updatetime'] = dr_date($r['updatetime']);}
{php $api['relatedlist'][$key]['description'] = dr_strcut($r['description'], 100, '...');}
{php $api['relatedlist'][$key]['user_avatar'] = dr_avatar($r['uid']);}
{php $api['relatedlist'][$key]['support'] = intval($r['support']);}
{php $api['relatedlist'][$key]['comments'] = $r['comments'];}
{/related}
{php $api['relatedlist']['total'] = $total;}
{php $api['relatedlist']['nums'] = $nums;}
{php $api['relatedlist']['page'] = $page;}
{php $api['relatedlist']['pagesize'] = $pagesize;}
注意 retuen=r
下面 $key 要對應寫成 $key_r