求教各位高手商品分类的标签是什么?

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

文件:category.dwt
标题写的是:<title>{$page_title}</title>,结果出来的是商品分类和网站名称
想请教高手,如果我只想出来分类应该怎么写?

回答:
includes\lib_main.php134行,以下代码
  1. /* 初始化“页面标题”和“当前位置” */
  2. $page_title = $GLOBALS['_CFG']['shop_title'] . ' - ' . 'Powered by ECShop';
  3. $ur_here = '<a href=".">' . $GLOBALS['_LANG']['home'] . '</a>';

  4. /* 根据文件名分别处理中间的部分 */
  5. if ($filename != 'index')
  6. {
  7. /* 处理有分类的 */
  8. if (in_array($filename, array('category', 'goods', 'article_cat', 'article', 'brand')))
  9. {
  10. /* 商品分类或商品 */
  11. if ('category' == $filename || 'goods' == $filename || 'brand' == $filename)
  12. {
  13. if ($cat > 0)
  14. {
  15. $cat_arr = get_parent_cats($cat);

  16. $key= 'cid';
  17. $type = 'category';
  18. }
  19. else
  20. {
  21. $cat_arr = array();
  22. }
  23. }
  24. /* 文章分类或文章 */
  25. elseif ('article_cat' == $filename || 'article' == $filename)
  26. {
  27. if ($cat > 0)
  28. {
  29. $cat_arr = get_article_parent_cats($cat);

  30. $key= 'acid';
  31. $type = 'article_cat';
  32. }
  33. else
  34. {
  35. $cat_arr = array();
  36. }
  37. }

  38. /* 循环分类 */
  39. if (!empty($cat_arr))
  40. {
  41. krsort($cat_arr);
  42. foreach ($cat_arr AS $val)
  43. {
  44. $page_title = htmlspecialchars($val['cat_name']) . '_' . $page_title;
  45. $args = array($key => $val['cat_id']);
  46. $ur_here.= ' <code>&gt;</code> <a href="' . build_uri($type, $args, $val['cat_name']) . '">' .
  47. htmlspecialchars($val['cat_name']) . '</a>';
  48. }
  49. }
  50. }
  51. /* 处理无分类的 */
  52. else
  53. {
  54. /* 团购 */
  55. if ('group_buy' == $filename)
  56. {
  57. $page_title = $GLOBALS['_LANG']['group_buy_goods'] . '_' . $page_title;
  58. $args = array('gbid' => '0');
  59. $ur_here.= ' <code>&gt;</code> <a href="group_buy.php">' .
  60. $GLOBALS['_LANG']['group_buy_goods'] . '</a>';
  61. }
  62. /* 拍卖 */
  63. elseif ('auction' == $filename)
  64. {
  65. $page_title = $GLOBALS['_LANG']['auction'] . '_' . $page_title;
  66. $args = array('auid' => '0');
  67. $ur_here.= ' <code>&gt;</code> <a href="auction.php">' .
  68. $GLOBALS['_LANG']['auction'] . '</a>';
  69. }
  70. /* 批发 */
  71. elseif ('wholesale' == $filename)
  72. {
  73. $page_title = $GLOBALS['_LANG']['wholesale'] . '_' . $page_title;
  74. $args = array('wsid' => '0');
  75. $ur_here.= ' <code>&gt;</code> <a href="wholesale.php">' .
  76. $GLOBALS['_LANG']['wholesale'] . '</a>';
  77. }
  78. /* 其他的在这里补充 */
  79. }
  80. }
复制代码
修改为:

  1. /* 初始化“页面标题”和“当前位置” */
  2. $page_title = 'Powered by ECShop';
  3. $ur_here = '<a href=".">' . $GLOBALS['_LANG']['home'] . '</a>';
  4. /* 根据文件名分别处理中间的部分 */
  5. if ($filename != 'index')
  6. {
  7. /* 处理有分类的 */
  8. if (in_array($filename, array('category', 'goods', 'article_cat', 'article', 'brand')))
  9. {
  10. /* 商品分类或商品 */
  11. if ('category' == $filename || 'goods' == $filename || 'brand' == $filename)
  12. {
  13. if ($cat > 0)
  14. {
  15. $cat_arr = get_parent_cats($cat);
  16. $key= 'cid';
  17. $type = 'category';
  18. }
  19. else
  20. {
  21. $cat_arr = array();
  22. }
  23. }
  24. /* 文章分类或文章 */
  25. elseif ('article_cat' == $filename || 'article' == $filename)
  26. {
  27. if ($cat > 0)
  28. {
  29. $cat_arr = get_article_parent_cats($cat);
  30. $key= 'acid';
  31. $type = 'article_cat';
  32. }
  33. else
  34. {
  35. $cat_arr = array();
  36. }
  37. }
  38. /* 循环分类 */
  39. if (!empty($cat_arr))
  40. {
  41. krsort($cat_arr);
  42. foreach ($cat_arr AS $val)
  43. {
  44. $page_title = htmlspecialchars($val['cat_name']) . '_' . $page_title;
  45. $args = array($key => $val['cat_id']);
  46. $ur_here.= ' <code>&gt;</code> <a href="' . build_uri($type, $args, $val['cat_name']) . '">' .
  47. htmlspecialchars($val['cat_name']) . '</a>';
  48. }
  49. }
  50. }
  51. /* 处理无分类的 */
  52. else
  53. {
  54. /* 团购 */
  55. if ('group_buy' == $filename)
  56. {
  57. $page_title = $GLOBALS['_LANG']['group_buy_goods'] . '_' . $page_title;
  58. $args = array('gbid' => '0');
  59. $ur_here.= ' <code>&gt;</code> <a href="group_buy.php">' .
  60. $GLOBALS['_LANG']['group_buy_goods'] . '</a>';
  61. }
  62. /* 拍卖 */
  63. elseif ('auction' == $filename)
  64. {
  65. $page_title = $GLOBALS['_LANG']['auction'] . '_' . $page_title;
  66. $args = array('auid' => '0');
  67. $ur_here.= ' <code>&gt;</code> <a href="auction.php">' .
  68. $GLOBALS['_LANG']['auction'] . '</a>';
  69. }
  70. /* 批发 */
  71. elseif ('wholesale' == $filename)
  72. {
  73. $page_title = $GLOBALS['_LANG']['wholesale'] . '_' . $page_title;
  74. $args = array('wsid' => '0');
  75. $ur_here.= ' <code>&gt;</code> <a href="wholesale.php">' .
  76. $GLOBALS['_LANG']['wholesale'] . '</a>';
  77. }
  78. /* 其他的在这里补充 */
  79. }
  80. }
  81. else
  82. {
  83. $page_title = $GLOBALS['_CFG']['shop_title'] . ' - ' . 'Powered by ECShop';
  84. }
复制代码

好帖,收藏了!