【发布时间】:2021-01-09 14:07:36
【问题描述】:
我在 mojolicious 中有一个任务,我必须将 html 表中的行数传递给 模板文件夹,在模板文件夹中,基于行数,它必须生成我要求的必要数量的行,为此我必须使用循环。这个想法是,我写下我想要的 roes 数量,例如 3,提交,然后程序生成我想要的正确数量。也许我应该使用哈希?
我的控制器:
my @rownum = (1,2,3,4,5);
$self->render("table/tablerow", rownum => \@rownum);
这是模板中的代码。
<html>
<head>
<style type="text/css">
TABLE {
border-collapse: collapse;
}
TD, TH {
padding: 10px;
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr><th>Heading 1</th><th>Heading 2</th></tr>
<tr><td>Cell 1</td><td>Cell 2</td></tr>
</table>
</body>
</html>
【问题讨论】:
-
什么模板系统? ep?
-
是的,没错,我想用 ep 在那里写 perl 代码。
标签: html perl mojolicious