Why is there a smarty loop fetch? every time you get the same content, Big Brother, beginner php and smatry, please advise. Why are all files generated? the content is the same. I printed it again, but it was correct. Foreach & nbsp; (& nbsp; $ category & nbsp; as & nbsp; $ c & nbsp;) & nbsp; {Why is the smarty loop fetch the same?
Dear Big Brother, I am a beginner in php and smatry. please advise.
Why are all files generated? the content is the same.
I printed it again, but it was correct.
Foreach ($ category as $ c ){
$ Products = $ util-> getArrayByQueryString ("select * from product_detail where sid = $ c [id]");
$ Smarty-> assign ("html_title", $ c [name]. ': all subclass products ');
$ Smarty-> assign ("products", $ products );
// Foreach ($ products as $ p ){
// Echo $ p [id]. $ p [name].'
';
//}
$ Content = $ smarty-> fetch ("products. tpl ");
$ File_name = './products/'. $ c [id]. '.html ';
// Html generation
Create_html ($ file_name, $ content );
}
------ Solution --------------------
$ Content = $ smarty-> fetch ("products. tpl", parameters such as ID );
Try this way