如何改连接路径

2016-07-07 15:06 来源:www.chinab4c.com 作者:ecshop专家

请问我想改<a href="{$goods.url}">的连接路径,就是{$goods.url}的值,应该改哪个文件呢?在什么位置,麻烦高手解答,万分感谢。

回答:
要说清楚哪个dwt文件

你自己都已经知道这个值了 改掉不就可以了

$goods.url 对应的值在哪里定义啊

在includes/lib_goods.php 找你的那个函数 然后就可以找到定义url

  1. /**
  2. * 获得推荐商品
  3. *
  4. * @access public
  5. * @param string $type 推荐类型,可以是 best, new, hot, promote
  6. * @return array
  7. */
  8. function get_recommend_goods($type = '', $cats = '',$num ='')
  9. {
  10. if (!in_array($type, array('best', 'new', 'hot', 'promote')))
  11. {
  12. return array();
  13. }

  14. $time = gmtime();

  15. $order_type = 0;

  16. /* 取得每一项的数量限制 */
  17. $type2lib = array('best'=>'recommend_best', 'new'=>'recommend_new', 'hot'=>'recommend_hot', 'promote'=>'recommend_promotion');
  18. // $num = get_library_number($type2lib[$type]);

  19. $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
  20. "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
  21. "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, " .
  22. "g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " .
  23. 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
  24. 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' .
  25. "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
  26. "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
  27. 'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ';
  28. if ($type == 'best')
  29. {
  30. $sql .= ' AND g.is_best = 1 ';
  31. }
  32. elseif ($type == 'new')
  33. {
  34. $sql .= ' AND g.is_new = 1 ';
  35. }
  36. elseif ($type == 'hot')
  37. {
  38. $sql .= ' AND g.is_hot = 1 ';
  39. }
  40. elseif ($type == 'promote')
  41. {
  42. $sql .= " AND g.is_promote = 1 AND promote_start_date <= '$time' AND promote_end_date >= '$time' ";
  43. }
  44. $sql .= $order_type == 0 ? ' ORDER BY g.goods_id desc' : ' ORDER BY rnd';
  45. $sql .= " LIMIT $num ";

  46. $result = $GLOBALS['db']->getAll($sql);

  47. $goods = array();
  48. foreach ($result AS $idx => $row)
  49. {
  50. if ($row['promote_price'] > 0)
  51. {
  52. $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
  53. $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
  54. }
  55. else
  56. {
  57. $goods[$idx]['promote_price'] = '';
  58. }

  59. $goods[$idx]['id'] = $row['goods_id'];
  60. $goods[$idx]['name'] = $row['goods_name'];
  61. $goods[$idx]['brief'] = $row['goods_brief'];
  62. $goods[$idx]['brand_name'] = $row['brand_name'];
  63. $goods[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);

  64. $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ?
  65. sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length'],false) : $row['goods_name'];
  66. $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'],$row['goods_name_style']);
  67. $goods[$idx]['market_price'] = price_format($row['market_price']);
  68. $goods[$idx]['shop_price'] = price_format($row['shop_price']);
  69. $goods[$idx]['thumb'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];
  70. $goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];
  71. $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
  72. }

  73. return $goods;
  74. }
复制代码


$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);类似这样 你可以改。官方为什么这样做 为了 可以在后台实现控制 是否用伪静态地址表现