首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

为啥smarty循环fetch的话,每次内容都一样

2013-01-05 
为什么smarty循环fetch的话,每次内容都一样各位大哥,小弟初学php和smatry,请指教。为什么文件都生成了,就是

为什么smarty循环fetch的话,每次内容都一样
各位大哥,小弟初学php和smatry,请指教。
为什么文件都生成了,就是里面的内容都一样的。
我又打印了下,但是打印出来的都是正确的。


foreach ( $category as $c ) {
$products = $util->getArrayByQueryString ( "select * from product_detail where sid=$c[id]" );
$smarty->assign ( "html_title", $c [name] . ':所有子类产品' );
$smarty->assign ( "products", $products );
//foreach ( $products as $p ) {
//echo $p [id] . $p [name] . '<br/>';
//}
$content = $smarty->fetch ( "products.tpl" );
$file_name = './products/' . $c [id] . '.html';
//html生成
create_html ( $file_name, $content );
}

[解决办法]
$content = $smarty->fetch ( "products.tpl",ID之类的参数 );

这样试试

热点排行