首页商品评论怎样加个外框

2016-07-07 16:27 来源:www.chinab4c.com 作者:ecshop专家

首页商品评论怎样加个外框,没有边框实在不美观,
内容头部一直有段空白,怎样去掉?看图片 网站:www.hpmore.cn
代码用的是http://bbs.ecshop.com/viewthread.php?tid=64773&extra=&highlight=%B5%F7%D3%C3%2B%C6%C0%C2%DB&page=1
  1. <?php

  2. if(!function_exists("get_comments")){
  3. function get_comments($num)
  4. {
  5. $sql = 'SELECT * FROM ecs_comment '.
  6. ' WHERE status = 1 AND parent_id = 0 and comment_type=0 '.
  7. ' ORDER BY add_time DESC';
  8. if ($num > 0)
  9. {
  10. $sql .= ' LIMIT ' . $num;
  11. }
  12. //echo $sql;

  13. $res = $GLOBALS['db']->getAll($sql);
  14. $comments = array();
  15. foreach ($res AS $idx => $row)
  16. {

  17. $comments[$idx]['user_name'] = $row['user_name'];
  18. $comments[$idx]['content'] = $row['content'];
  19. $comments[$idx]['id_value'] = $row['id_value'];

  20. }
  21. return $comments;
  22. }
  23. }

  24. ?>

  25. <meta http-equiv="Content-Type" content="text/html; charset=gbk">

  26. <!--数据调用-最新评论开始 -->
  27. <?php
  28. $this->assign('my_comments',get_comments(6)); // 6代表会条数据
  29. ?>

  30. <div id="promotion">
  31. <div class="sortbg">
  32. <div id="comments_left"></div>
  33. <div id="comments_right"></div>
  34. </div>
  35. <div class="sort">
  36. <ul style="padding-left:8px">

  37. <b>最新商品评论:</b>
  38. <!--{foreach from=$my_comments item=comments}-->
  39. <li><a href="goods.php?id={$comments.id_value}" target="_blank">{$comments.content|truncate:13:""}</a></li>
  40. <!--{/foreach}-->



  41. </ul>
  42. </div>
  43. </div>
复制代码

Snap1.jpg (15.08 KB)

Snap1.jpg


回答:
外边套一个<div style="border:1px solid #ccc"></div>

谢谢,外框加上了,有一点宽,不知道在哪里调整?
  1. <?php
  2. if(!function_exists("get_comments")) {
  3. function get_comments($num) {
  4. $sql = 'SELECT * FROM ecs_comment '.
  5. ' WHERE status = 1 AND parent_id = 0 and comment_type=0 '.
  6. ' ORDER BY add_time DESC';
  7. if ($num > 0) {
  8. $sql .= ' LIMIT ' . $num;
  9. }
  10. //echo $sql;
  11. $res = $GLOBALS['db']->getAll($sql);
  12. $comments = array();
  13. foreach ($res AS $idx => $row) {
  14. $comments[$idx]['user_name'] = $row['user_name'];
  15. $comments[$idx]['content'] = $row['content'];
  16. $comments[$idx]['id_value'] = $row['id_value'];
  17. }
  18. return $comments;
  19. }
  20. }
  21. ?>
  22. <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  23. <?php
  24. $this->assign('my_comments',get_comments(6)); // 6这里指调用的条数
  25. ?>
  26. <body topmargin="0">

  27. <div style="border:1px solid #ccc">
  28. <div id="promotion" class="box">
  29. <h2 align="center"><font size="2">最新评论:</font></h2>
  30. <div class="box_list">
  31. <!--{foreach from=$my_comments item=comments}-->
  32. <p class="comment">{$comments.content|truncate:14:"..."}</p>
  33. <p class="comment">作者:{$comments.user_name} <a href="goods.php?id={$comments.id_value}" target="_blank">[详细内容]</a></p>
  34. <!--{/foreach}-->
  35. </div>
  36. </div>
  37. </div>
复制代码