Let me directly write down the operation steps. Let's take a look at the ideas. I believe everyone will do the same.
Step 1:
Build a UDF in includes/lib_goods.php
/* ** Get recent comments ** @ return Array */ Function Get_latest_comment ( $ Limit_num ){ $ SQL = "Select C. Content, C. add_time, G. goods_id, G. goods_name from ". $ Globals ['Ecs']-> table ('comment ')." As C left join ". $ Globals ['Ecs']-> table ('goods ')."As g on C. id_value = G. goods_id where C. Status = 1 Limit ". $ Limit_num ; $ Res = $ Globals ['Db']-> getall ( $ SQL ); Return $ Res ;}
Step 2:
In the root directory of goods. php, $ smarty-> assign ('goods _ rank ', get_goods_rank ($ goods_id); // The sales ranking of the Product
Add the followingCode
$ Smarty-> Assign ('comments _ latest ', get_latest_comment (10 ));//Get the latest product Theory
Step 3:
Create the comments_latest.lbi file in the library directory.
Step 4:
Use the following code in the template file goods. DWT to call the "latest comment" on the product details page"
<! --#Beginlibraryitem "/library/comments_latest.lbi" --> <! -- # Endlibraryitem -->
OriginalArticle, Reprint please indicate the source: http://www.cnblogs.com/hongfei/archive/2013/01/04/2844539.html