Ecshop Tutorial Homepage Perfect to call the latest comments

Source: Internet
Author: User

First step: Create a library file named Index_comments.lbi under the template under the Library folder

Step Two: Call the newly created library file in INDEX.DWT
I'm putting the latest reviews under the sales line.

" /library/index_comments.lbi " -  "/library/top10.lbi"  -<!--#EndLibraryItem--and back.



Step three: Open File languages/zh_cn/admin/template.php
Join 64 Rows---127 rows

$_lang['template_libs'['index_comments ' Latest comments ';


Fourth step: Open \admin\includes\lib_template.php I call on the homepage, so just add it here on the line. Bold to add part

'Index'=Array ('/library/ur_here.lbi'=0, '/library/index_comments.lbi' = 0, '/library/search_form.lbi'=0,        '/library/member.lbi'=0,        '/library/new_articles.lbi'=0,        '/library/category_tree.lbi'=0,        '/library/top10.lbi'=0,        '/library/invoice_query.lbi'=0,        '/library/recommend_best.lbi'=3,        '/library/recommend_new.lbi'=3,        '/library/recommend_hot.lbi'=3,        '/library/recommend_promotion.lbi'=4,        '/library/group_buy.lbi'=3,        '/library/auction.lbi'=3,        '/library/brands.lbi'=3,        '/library/promotion_info.lbi'=0,        '/library/cart.lbi'=0,        '/library/order_query.lbi'=0,        '/library/email_list.lbi'=0,        '/library/vote_list.lbi'=0    ),


Fifth Step: Open \themes\bigsale (here is the template I use) under the Libs.xml (I just called on the homepage so just change the homepage template can) bold to add part

<file name="index.dwt">    <region name=" banner ad bit "/ >    <region name=" left area ">      <lib>category_tree</lib>      <lib>top10</lib>   <lib>index_comments</lib>      <lib> promotion_info</lib>      <lib>order_query</lib>      <lib>invoice_query</lib>      <lib>email_list</lib>      <lib>vote_list</lib>    </region>


This is the perfect home page to invoke the latest comments. No more worrying about being refreshed by re-setting the template

Here's what's INDEX_COMMENTS.LBI:

<?PHPif(!function_exists ("get_comments") {function get_comments ($num) {$sql='SELECT A.*,b.goods_id,b.goods_thumb,b.goods_name from'. $GLOBALS ['ECS']->table ('Comment') . 'as a,'. $GLOBALS ['ECS']->table ('Goods') .'As b WHERE a.status = 1 and a.parent_id = 0 and a.comment_type=0 and a.id_value=b.goods_id'. 'ORDER by A.add_time DESC'; if($num >0) {$sql.='LIMIT'. $num; }  //echo $sql;$res= $GLOBALS ['DB']->GetAll ($sql); $comments=Array (); foreach($res as $idx =$row) {$comments [$idx] ['Add_time'] = Local_date ($GLOBALS ['_cfg']['Time_format'], $row ['Add_time']); $comments [$IDX] ['content'] = $row ['content']; $comments [$IDX] ['Id_value'] = $row ['Id_value']; $comments [$IDX] ['Goods_thumb'] = Get_image_path ($row ['goods_id'], $row ['Goods_thumb'],true); $comments [$IDX] ['Goods_name'] = $row ['Goods_name']; }  return$comments;}}? ><meta http-equiv="Content-type"Content="text/html; Charset=utf-8"><!--Reviews-<?PHP $ This->assign ('my_comments', Get_comments (6));//? ><divclass="module_2"> &LT;H2class="Modtitle TL"> <spanclass="L"></span><spanclass="R"></span> Latest Comments foreach  from= $my _comments item=comments}--><table width="100%"Border="0"cellspacing="0"cellpadding="0"style="border-bottom:1px #ccc dashed;"> <tr> <td width=" the"height=" -"align="Center"><a href="goods.php?id={$comments. Id_value}"target="_blank">"{$comments. Goods_thumb}"Border="0"Width=" -"height=" -"style="border:1px #CCCCCC solid;"/></a></td> &LT;TD width="473"align=" Left"valign="Top"><div style="height:3px; overflow:hidden;">&nbsp;</div><div><a href="goods.php?id={$comments. Id_value}"target="_blank"><font style="color: #FF0000; font-size:14px;">{$comments. goods_name}</font></a></div><div>{$comments. Content|truncate: -:""}</div><div style="color: #999999;">{$comments .add_time}</div></td> </tr></table> <!--{/foreach}--> </div>



Ecshop Tutorial Homepage Perfect to call the latest comments

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.