我正在使用简单的HTML创建电子邮件模板。但是我被困在必须列出来自Java代码的数据的列表中。另外,我不确定每次获取的列表的长度。
我试图做类似下面的代码。但这没有用。
<span style="font-size:19px;font-weight:bold;font-family: Calibri;">Dear $customer,</b></span><br>
<br>
<br>
<span style="font-size:14px;font-family: Calibri;">Below List of Products orderd</br>
<table>
<tr>
<th><ul>
<li>$ProdID</li>
</ul></th>
<th><ul>
<li>$PrdoName</li>
</ul></th>
</tr>
</table>
<br>
Thank you for choosing US </br>
</br>
Genuinely,<br />
<br />
<span style="font-size:16px; font-weight:bold;font-family: Calibri;">E - commerce</span></span>
</div>
</td>
</tr>
<tr>
<td><hr noshade size=1 width="100%" style="margin:0" align=left>
<div id="footerTxt" style=" font-family: Calibri;line-height:18px; margin:20px 0;">
<span style="font-size:12px; color:#999"><br />
©E-Commerce L.P. </span>
请帮助我将$ prodID打印为列表,我已将值作为字符串列表传递了
答案 0 :(得分:0)
我假定用于html模板制作的语言是PHP,因为变量前面带有$符号。请按下面的代码进行引用
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><span style="font-size:19px;font-weight:bold;font-family: Calibri;">Dear <?php echo $customer?>,</span></td>
</tr>
<tr>
<td><span style="font-size:14px;font-family: Calibri;">Below List of Products ordered:</span></td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<th>Prod ID</th>
<th>Prod Name</th>
</tr>
<?php foreach($products as $product) {?>
<tr>
<td><?php echo $product->prodID ?></td>
<td><?php echo $product->prodName ?></td>
</tr>
<?php } ?>
</table>
</td>
</tr>
<tr>
<td>
Thank you for choosing US </br>
Genuinely,<br /><br />
<span style="font-size:16px; font-weight:bold;font-family: Calibri;">E - commerce</span></span>
</td>
</tr>
<tr>
<td>
<hr noshade size=1 width="100%" style="margin:0" align=left>
<div id="footerTxt" style=" font-family: Calibri;line-height:18px; margin:20px 0;"><span style="font-size:12px; color:#999"><br />©E-Commerce L.P. </span></div>
</td>
</tr>
</table>