Smarty PHP/template output problem -
I have an issue on this page.
For ($ i = 0; $ main night [$ i]! = ''; $ I ++) {$ query = mysql_query ("Choose ... from ... ou id = $ i") or die (mysql_error ()); While ($ tmp = mysql_fetch_assoc ($ query) $$ some [] = $ tmp; } $ Smarty- & gt; Assign ('content'. $ I, $ some); }
I can do it manually
{section name = i loop = $ stuff1} ..... {/ section} { Section name = I loop = $ stuff2} ..... {/ section}
but not really good way.
How just put your "content" into an array?
$ stuff = arrray (); ($ I = 0; $ main [$ i]! = ''; $ I ++) {$ query = mysql_query ("Choose ... from ... where id = $ i") or die (mysql_error () ); While ($ tmp = mysql_fetch_assoc ($ query) $$ some [] = $ tmp; } $ Luggage [] = $ some; } $ Smarty- & gt; Assign ('content', $ accessories);
Then you can just loop on the stuff in the template.
Comments
Post a Comment