J5增加PDF附件下载功能

weeya4个月前JTBC教程52

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_04产品新闻列表页

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

J5_10多语言

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

J5_09搜索

    需要在可以被搜索的模块目录中手动添加common/search.jtbc引导文件来激活搜索功能    需要手动构建关键字输入框并通过...

J5_03首页模板

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

J5网站首页增加SEO标题

网站增加首页标题1、/Public/common/language/communal.jtbc文件增加节点    <item>  &nbs...

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

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

发表评论    

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