联系官方销售客服

1835022288

028-61286886

应用插件 版主:官方插件技术组
内容页关联文章标签related接口调用不显示
类型:迅睿CMS 更新时间:2022-04-02 09:39:01 return API接口
插件 API接口 V7.7
应用作者 迅睿官方团队
发布时间 2019-03-14 09:57:26
更新时间 2024-08-24 20:57:34

内容页关联文章标签related接口调用不显示?

{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}



应用版权:官方
应用名称:API接口

插件教程:https://www.xunruicms.com/doc/app-361.html

回帖
  • 官方插件技术-胡老师
    #1楼    官方插件技术-胡老师
    2022-04-02 03:45:44
    Chrome 0
    $tag 缺少来源
    $api[$key][变量]=值
  • likeren
    #2楼    likeren
    2022-04-02 08:14:53
    Chrome 0
    官方插件技术-胡老师 辛苦了,这么晚还没休息 😁 这是内容页,没有[$key],研究了半天,现在调用出来后没有循环,求教
    {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
    #3楼    likeren
    2022-04-02 08:16:16
    Chrome 0
    likeren 官方插件技术-胡老师
    image
  • likeren
    #4楼    likeren
    2022-04-02 08:22:02
    Chrome 0
    增加悬赏(设置悬赏)金:5元,希望大家给予帮助!
  • 越王
    #5楼    越王
    2022-04-02 08:58:57
    Chrome 0
    你这只是定义没有输出吧
  • GoWorkRoom
    #6楼    GoWorkRoom
    2022-04-02 09:04:07
    Chrome 0
    一楼说明问题的根源了,$tag哪里来的,这是一个未知数了
  • likeren
    #7楼    likeren
    2022-04-02 09:11:13
    Chrome 0
    GoWorkRoom
    {php $api['tag'] = $tag;}
    是这个吗?
  • 浮生半日
    #8楼    浮生半日
    2022-04-02 09:12:41
    Chrome 0
    😛 可以求助小波,我找他写过很多次api接口了,很专业的
  • 小黄人 18html
    #9楼    小黄人 18html
    2022-04-02 09:19:47
    Chrome 0
    {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}
  • LandQ
    #10楼    LandQ
    2022-04-02 09:22:30
    Chrome 0
    {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;}
  • 小黄人 18html
    #11楼    小黄人 18html
    2022-04-02 09:29:49
    Chrome 0
    注意 retuen=r 下面 $key 要对应写成 $key_r
    image
    满意答案
  • likeren
    #12楼    likeren
    2022-04-02 09:39:01
    Chrome 0
    @小黄人 18html:辛苦小黄人了!多谢!