J5增加PDF附件下载功能

weeya1年前JTBC教程571

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_03首页模板

1、头尾模板调用代码{$=$take('global.communal.header')}{$=$take('global.communal.footer')}2、调用...

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

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

J5_01安装相关

JTBC5.0笔记jtbc模板里只要理解3个东西就完事儿了1个叫 $take1个叫 $render另外1个叫 $fetch/Config/DB/MySQL.php,数据库链接~~~~~~~~~~~~~...

J5_06关于我们联系我们内容页

1、头尾模板调用代码{$=$take('global.communal.header')}{$=$take('global.communal.footer')}{$ti...

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

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

J5列表中获取当前分类的父分类ID

以新闻模块为例子。打开/news/common/diplomat/index.php找到public function list(Request $req, Response $res)函数修改以下内...

发表评论    

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