在.php中
while ($line = mysql_fetch_assoc($result)){
$value[] = $line;
$value['newvalue'] ='223457';
}
$smarty->assign('view', $value);在.tpl中
{section name=i loop=$view}
{$view[i].newvalue}
{/section}在smarty中没有newvalue.im菜鸟的输出
发布于 2010-01-19 14:58:31
你已经很接近了,也许...不管怎么说,这就是你想要的。确保缩进你的代码,这样人们就可以阅读它。
$c=0;
while ($line = mysql_fetch_assoc($result)){
$value[$c] = $line;
$value[$c]['newvalue'] ='223457';
$c++;
}
$smarty->assign('view', $value);在.tpl中:
{foreach item=v from $view}
{$v.newvalue}
{/foreach}https://stackoverflow.com/questions/2090890
复制相似问题