用< li>换行 [英] wrap new line variable with <li>
本文介绍了用< li>换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们正在使用WHMCS,并且在产品部分中,我想在每个新行上用< li></li>
包装产品.到目前为止,我已经完成了以下操作,这使我获得了所有项目,但是将它们全部放在一行中,但是我还无法弄清楚如何将这些剥离的值分配给要用list标记包装的新var.
We are using WHMCS and within the product section I want to wrap the product with <li></li>
on every new line. So far I have done the following, which gets me all the items but puts them all in one line, but I haven't been able to work out how to assign these stripped values to a new var to be wrapped with the list tag.
{foreach from=$product.features key=feature item=value}
{$value|strip_tags}
{foreachelse}
{$product.description|strip_tags}
{/foreach}
推荐答案
您可以使用以下代码:
{assign var=lines value="\n"|explode:$product.description|strip_tags}
<ul>
{foreach key=k item=line from=$lines}
<li>{$line}</li>
{/foreach}
</ul>
这篇关于用< li>换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文