J5增加PDF附件下载功能

weeya2年前JTBC教程911

1、模块管理增加att字段,选择29附件管理器
2、模板代码
<table class="table table-striped m-0">
<tbody>
<tr>
<th class="border-top-0">
 附件下载:
</th>
<td class="border-top-0">
<a href="{$=$htmlEncode($getValueFromJSON(#att, '0->filepath'))}" alt="{$=$htmlEncode($getValueFromJSON(#att, '0->filename'))}" target="_blank">{$=$htmlEncode($getValueFromJSON(#att, '0->filename'))}
</a>
</td>
<td class="border-top-0">
<a href="{$=$htmlEncode($getValueFromJSON(#att, '1->filepath'))}" alt="{$=$htmlEncode($getValueFromJSON(#att, '1->filename'))}" target="_blank">{$=$htmlEncode($getValueFromJSON(#att, '1->filename'))}
</a>
</td>
</tbody>
</table>
到此完工。


下列方法无上传附件文章id有报错。
2、模板调用{$=$render('global.render.pdf',$jsonDecode(#att))}
3、pdf节点代码如下:
<table class="table table-striped m-0">
<tbody>
{@}<tr>
<th class="border-top-0">
附件下载:
</th>
<td class="border-top-0">
<a href="{$filepath}" alt="{$filename}" target="_blank">{$filename}
</a>
</td>
</tr>
{@}
</tbody>
</table>

相关文章

J5详情页获取当前分类父分类ID

1、修改程序 /public/zhiwu/common/template/index.jtbc文件public function detail(Request $req, Response $res)...

J5模块首页-列表分类-文章页面自定义TDK

J5模块首页-列表分类-文章页面自定义TDK方法1、模块添加字段,后台开发维护》模块管理》右边的设置,在模块设置界面,点击右上角添加新字段按钮添加3个字段,用来存储自定义的TDK数据seotitle,...

J5_07核心团队合作伙伴

核心团队team/荣誉资质honor,有列表页,有内容页{@}<a href="./?type=detail&amp;id={$id}" class="id...

J5伪静态

Public/news/.rewrite的地址重写配置:<?phpreturn [  [    'file' => 'ind...

J5增加tag标签自定义URL

1、index.php文件detail节点$rsTag = strval($rs -> tag);//增加tag模块管理-添加字段tag,16标签输入框。2、tag/矿山副井井筒装备安装/htt...

J5_11增加手机站

1、Public/common/diplomat/index.php文件    return Jtbc::take('index.index');替换成&...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。