Ask how to write this PHP code in the HTM template. Ask how to write this PHP code in the HTM template.
Foreach ($ _ SESSION ["shoplist"] as $ v ){
Echo"";
Echo"". $ V ['id']."";
Echo"". $ V ['Ps']."";
Echo"". $ V ['zzs']." $";
Echo"";
$ Sum + = $ v ['zzs'] * $ v ['num'];
}
Reply to discussion (solution)
It depends on what template engine you are using.
However, you must pay attention to the following rules when using other things. Cannot be empty
Php code cannot be directly executed for html files.
Add the following code to your HTML and change it to. php.
"; echo "".$v['id'].""; echo "".$v['pm'].""; echo "".$v['zzs']."¥"; echo "";$sum += $v['zzs']*$v['num'];}?>
Many templates do not support php code.
Use the smarty template with the foreach function
I use DZ templates.
Php code cannot be directly executed for html files.
Add the following code to your HTML and change it to. php.
"; echo "".$v['id'].""; echo "".$v['pm'].""; echo "".$v['zzs']."¥"; echo "";$sum += $v['zzs']*$v['num'];}?>
That's what I wrote now. I want to write it to the template. DZ template.