J5增加PDF附件下载功能

weeya1年前JTBC教程447

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_06关于我们联系我们内容页

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

J5_05产品新闻详情页

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

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

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

J5_07核心团队合作伙伴

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

J5伪静态

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

J5_10多语言

多语言/Public/console/common/language/sel_lang.jtbc增加节点不同语言不同模板Public/common/diplomat/index.php修改return...

发表评论    

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