<ul>
{foreach from=$recommend item=value}
<li><span><em>{$value['content']}</em></span></li>
{/foreach}
</ul>
<ul>
{foreach from=$recommend item=value}
<li><h4>{$value['name']}</h4></li>
{/foreach}
</ul>
The above html can be generated by 1 loop if not using smarty:
$html1 = $html2 = '<ul>';
foreach($recommend as $value)
{
$html1 .= '<li><span><em>' . $value['content'] . '</em></span></li>';
$html2 .= '<li><h4>' . $value['name'] . '</h4></li>';
}
$html1 .= '</ul>';
$html2 .= '</ul>';
$html = $html1 . $html2;
but I don't know how to do it when smarty is required.