导航

ecshop title优化

Posted on 2014-04-21 14:36  ghostll  阅读(273)  评论(0编辑  收藏  举报

刚用ecshop新做了个商城,收集了不少title优化,分享下

 

网站首页标题显示的是为ECSHOP管理中心的[商店标题]。而频道页面,显示的是[频道名+商店名称]。当然商品页面显示的是[商品名+商店名称]

第一步,去掉标题上的Powered byEcshop字样。在includes/lib_main.php找到lib_main.php文件,去掉下面这段代码。
. ‘ - ‘ . ‘Powered by ECShop’

第二步,打开模板文件夹的goods.dwt文件,找到{$page_title},将它修改为{$goods.goods_style_name}_{$shop_name}

第三步,找到includes/lib_main.php第143行。将
$page_title=$GLOBALS['_CFG']['shop_title'];
改为
$page_title=$GLOBALS['_CFG']['shop_name'];

然后找到241行左右,找到下面这样的代码
if (!empty($str))
{
$page_title  = $str . '_' . $page_title;
$ur_here .= '<code>&gt;</code>' . $str;
}

我们需要在这段代码的前面,加入
if ($filename == 'index')$page_title=$GLOBALS['_CFG']['shop_title'];
这段代码即可。

 

 

 

去除底部的'Powered by ECShop';

很多朋友想直接删除themes/default/library/page_footer.lbi文件中的代码:{foreach from=$lang.p_y item=pv}{$pv}{/foreach}{$licensed}<br/> ,然而删除后'Powered by ECShop'就会在网页中乱跑,故而无法实现我们的效果。

打开js/common.js文件;

将该文件第261行到第353行代码删除:

onload = function()
{
    varlink_arr = document.getElementsByTagName_r(String.fromCharCode(65));
    varlink_str;
    varlink_text;
    varregg, cc;
    varrmd, rmd_s, rmd_e, link_eorr = 0;
    vare = newArray(97, 98, 99,
                      100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
                      110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
                      120, 121, 122
                      );
 

try

  {
    for(vari = 0; i < link_arr.length; i++)
    {
      link_str = link_arr[i].href;
      if(link_str.indexOf(String.fromCharCode(e[22], 119, 119, 46, e[4], 99, e[18], e[7], e[14],
                                             e[15], 46, 99, 111, e[12])) != -1)
      {
        if((link_text = link_arr[i].innerText) == undefined)
        {
            throw"noIE";
        }
        regg = newRegExp(String.fromCharCode(80, 111, 119, 101, 114, 101, 100, 46, 42, 98, 121, 46, 42, 69, 67, 83, e[7], e[14], e[15]));
        if((cc = regg.exec(link_text)) != null)
        {
          if(link_arr[i].offsetHeight == 0)
          {
            break;
          }
          link_eorr = 1;
          break;
        }
      }
      else
      {
        link_eorr = link_eorr ? 0 : link_eorr;
        continue;
      }
    }
  } // IE
  catch(exc)
  {
    for(vari = 0; i < link_arr.length; i++)
    {
      link_str = link_arr[i].href;
      if(link_str.indexOf(String.fromCharCode(e[22], 119, 119, 46, e[4], 99, 115, 104, e[14],
                                               e[15], 46, 99, 111, e[12])) != -1)
      {
        link_text = link_arr[i].textContent;
        regg = newRegExp(String.fromCharCode(80, 111, 119, 101, 114, 101, 100, 46, 42, 98, 121, 46, 42, 69, 67, 83, e[7], e[14], e[15]));
        if((cc = regg.exec(link_text)) != null)
        {
          if(link_arr[i].offsetHeight == 0)
          {
            break;
          }
          link_eorr = 1;
          break;
        }
      }
      else
      {
        link_eorr = link_eorr ? 0 : link_eorr;
        continue;
      }
    }
  } // FF
 
  try
  {
    rmd = Math.random();
    rmd_s = Math.floor(rmd * 10);
    if(link_eorr != 1)
    {
      rmd_e = i - rmd_s;
      link_arr[rmd_e].href = String.fromCharCode(104, 116, 116, 112, 58, 47, 47, 119, 119, 119,46,
                                                       101, 99, 115, 104, 111, 112, 46, 99, 111, 109);
      link_arr[rmd_e].innerHTML = String.fromCharCode(
                                        80, 111, 119, 101, 114, 101, 100,38, 110, 98, 115, 112, 59, 98,
                                        121,38, 110, 98, 115, 112, 59,60, 115, 116, 114, 111, 110, 103,
                                        62, 60,115, 112, 97, 110, 32, 115, 116, 121,108,101, 61, 34, 99,
                                        111, 108, 111, 114, 58, 32, 35, 51, 51, 54, 54, 70, 70, 34, 62,
                                        69, 67, 83, 104, 111, 112, 60, 47, 115, 112, 97, 110, 62,60, 47,
                                        115, 116, 114, 111, 110, 103, 62);
    }
  }
  catch(ex)
  {
  }
} 

 

 

 

ECSHOP筛选属性修改title标题

 

 

 

发现百度蜘蛛爬行网站时会爬行属性链接,而且会进行收录。可是ecshop系统制作的网站,在分类页点击属性筛选出产品时,网页title不会改变。这样就会造成大量title一样的页面,不利于优化。为此,在网上查找ECSHOP筛选属性修改title的插件,大部分都是收费的。在这里把自己想到的修改办法分享给大家。

需要修改category.php文件,在这个文件查找到

foreach ($cat_filter_attr AS $key => $value)

在其前面加上一句代码

$shuxing_name = "";

查找

$all_attr_list[$key]['attr_list'][$temp_key]['selected'] = 1;

在后面加上

$shuxing_name.=$all_attr_list[$key]['attr_list'][$temp_key]['attr_value'];

查找

$smarty->assign('page_title', $position['title']);

改为

复制代码
if($shuxing_name!="")
{
$shuxing_name.="_".$position['title'];
}
else
{
$shuxing_name=$position['title'];
}
$smarty->assign('page_title', $shuxing_name);
复制代码

这样就可以实现筛选属性自动修改title标题了。

 

 

 

好了,ecshop的title优化基本完了;还有遗忘了等我想起再补充

详细的优化效果可看看我新做的钢笔商城——千笔阁

原文地址:http://blog.csdn.net/yeypnet/article/details/24148205

我的专栏