wrap new line variable with <li>

筅森魡賤 提交于 2019-12-25 05:34:05

问题


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}

回答1:


You can use the following code:

{assign var=lines value="\n"|explode:$product.description|strip_tags}
<ul>
{foreach key=k item=line from=$lines}
<li>{$line}</li>
{/foreach}
</ul>


来源:https://stackoverflow.com/questions/30259445/wrap-new-line-variable-with-li

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!