zencart怎样将EZ-pages页面的URL静态化

1、打开根目录中的.htaccess文件

查找代码:

RewriteRule ^(.*)-pri-([0-9]+).html$ index\.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]
在其后加入以下代码:

RewriteRule ^(.*)-ezp-([0-9]+).html$ index\.php?main_page=page&id=$2&%{QUERY_STRING} [L]


2、打开includes\classes\seo.url.php

2.1、查找代码: 'info_manager_page_id' => '-i-',

在其后加入以下代码:

// EZ-Pages SEO support
'id' => '-ezp-',

2.2、查找代码:if ( $this->attributes['USE_SEO_CACHE_INFO_PAGES'] == 'true' && defined('TABLE_INFO_MANAGER')) $this->generate_info_manager_cache();

在其后加入以下代码:

if ( $this->attributes['USE_SEO_CACHE_EZ_PAGES'] == 'true' ) $this->generate_ezpages_cache();

2.3、查找代码:

case 'pID':
                    switch(true){
                        case ($page == FILENAME_POPUP_IMAGE):
                        $url = $this->make_url($page, $this->get_product_name($p2[1]), $p2[0], $p2[1], '.html', $separator);
                        break;
                    default:
                        $container[$p2[0]] = $p2[1];
                        break;
                    } # end switch
                    break;

在其后加入以下代码:

case 'id':    // EZ-Pages
switch(true){
  case ($page == FILENAME_EZPAGES):
    $url = $this->make_url($page, $this->get_ezpages_name($p2[1]), $p2[0], $p2[1], '.html', $separator);
    break;
  default:
     $container[$p2[0]] = $p2[1];
     break;
} # end switch
break;

2.4、查找代码:function get_full_cPath($cID, &$original){
在其前面加入以下代码:

    function get_ezpages_name($ezpID){
        switch(true){
            case ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true' && defined('EZPAGES_NAME_' . $ezpID)):
                $sql = "SELECT pages_title as ezpName
                        FROM ".TABLE_EZPAGES."
                        WHERE pages_id='".(int)$ezpID."'
                        LIMIT 1";
                $result = $this->db->Execute($sql);
                $ezpName = $this->strip($result->fields['ezpName']);
                $return = $ezpName;
                //$return = constant('EZPAGES_NAME_' . $ezpID);
                $this->cache['EZPAGES'][$ezpID] = $return;
                break;
            case ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true' && isset($this->cache['EZPAGES'][$ezpID])):
                $sql = "SELECT pages_title as ezpName
                        FROM ".TABLE_EZPAGES."
                        WHERE pages_id='".(int)$ezpID."'
                        LIMIT 1";
                $result = $this->db->Execute($sql);
                $ezpName = $this->strip($result->fields['ezpName']);
                $return = $ezpName;
                //$return = $this->cache['EZPAGES'][$ezpID];
                break;
            default:
                $sql = "SELECT pages_title as ezpName
                        FROM ".TABLE_EZPAGES."
                        WHERE pages_id='".(int)$ezpID."'
                        LIMIT 1";
                $result = $this->db->Execute($sql);
                $ezpName = $this->strip($result->fields['ezpName']);
                $this->cache['EZPAGES'][$ezpID] = $ezpName;
                $return = $ezpName;
                break;
        } # end switch
        return $return;
    }

2.5、查找代码:    function generate_products_cache(){

在其前面加入以下代码:

    function generate_ezpages_cache(){
        $this->is_cached($this->cache_file . 'ezpages', $is_cached, $is_expired);
        if ( !$is_cached || $is_expired ) {
        $sql = "SELECT pages_id as id, pages_title as name
                FROM ".TABLE_EZPAGES."
                WHERE language_id = '".(int)$this->languages_id."'";
        $ezpages = $this->db->Execute($sql);
        $ezpages_cache = '';
        while (!$ezpages->EOF) {
            $define = 'define(\'EZPAGES_NAME_' . $ezpages->fields['id'] . '\', \'' . $this->strip($ezpages->fields['name']) . '\');';
            $ezpages_cache .= $define . "\n";
            eval("$define");
            $product->MoveNext();
        }
        $this->save_cache($this->cache_file . 'ezpages', $ezpages_cache, 'EVAL', 1 , 1);
        unset($ezpages_cache);
        } else {
            $this->get_cache($this->cache_file . 'ezpages');
        }
    } 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值