CMS字段url,如何处理

发布于 2019-11-08 10:03:55

如下图,后台生成url不带后缀,而前端导航生成的url带后缀,该如何统一?
image.png
image.png

查看更多

关注者
0
被浏览
52
1 个回答
MrCai
MrCai 认证专家 2019-11-08
这家伙很懒,什么也没写!

后台用的/application/admin/model/cms/Channel.php

public function getUrlAttr($value, $data)
{
    $diyname = $data['diyname'] ? $data['diyname'] : $data['id'];
    return isset($data['type']) && isset($data['outlink']) && $data['type'] == 'link' ? $data['outlink'] : addon_url('cms/channel/index', [':id' => $data['id'], ':diyname' => $diyname]);
}

前台用的addons/cms/model/Channel.php

public function getUrlAttr($value, $data)
{
    $diyname = $data['diyname'] ? $data['diyname'] : $data['id'];
    return isset($data['type']) && isset($data['outlink']) && $data['type'] == 'link' ? $data['outlink'] : addon_url('cms/channel/index', [':id' => $data['id'], ':diyname' => $diyname]);
}

public function getFullurlAttr($value, $data)
{
    $diyname = $data['diyname'] ? $data['diyname'] : $data['id'];
    return isset($data['type']) && isset($data['outlink']) && $data['type'] == 'link' ? $data['outlink'] : addon_url('cms/channel/index', [':id' => $data['id'], ':diyname' => $diyname], true, true);
}

url和fullurl都返回了,用的fullurl就带有后缀

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览