方法A.模块插件式安装,后台可以控制开关。
一..首先安装ISAPI_Rewrite FOR IIS6,用IIS支持REWRITE模块,最新的版本是2.8在这里下载:
ISAPI_Rewrite2.8下载地址
不管哪个版本的ZENCART要让IIS实现REWRITE这个是必装的,下完后安装文件是.MIS文件,直接默认安装就可以了.完成后重新启动IIS.
二.安装Ultimate SEO URLs 2.101 for Zen Cart1.3.01/安装Ultimate SEO URLs 2.100 for Zen Cart1.2.7
Ultimate SEO URLs 2.101 下载地址for Zen Cart1.3.01
Ultimate SEO URLs 2.100 下载地址for Zen Cart1.2.7
For this v1.3.0-compatible version, follow the installation instructions at the URL below, (1.3.0版本相对1.2.X的步骤稍有不同)
BUT WITH THE FOLLOWING EXCEPTIONS:
1. skip step #2 ... editing application_top.php(参照安装帮助跳过第2步。)
2. steps 3-5, already-edited versions of these files are in the "1301_specific_files" folder. (第3到第5步的文件修改已经包含在1301_specific_files文件夹中)
Simply upload these to the related folder on your site. You should rename the existing file to *.bak before copying.(上传前请务必先保存文件为*.BAK)
3. step 6 ... a sample .htaccess file is included. Simply rename to .htaccess and edit the word /shop/ to match your stie(第6步中的.htaccess文件中的内容如果站点在根目录也不用修改)。
安装详细步骤连接参考
INSTALLATION INSTRUCTIONS:
http://www.dream-scape.com/pub/zencart/Ultimate_SEO_URLs/install.html
三.取消ISAPI_Rewrite安装目录中的httpd.ini只读属性,然后编写规则
直接把第二步中的.htaccess文件中的内容复制过来.
关键的步骤到了,这也是IIS和APC下的不同
第一: ?改为\?
第二:表示转换符号的 $+空格 改为 空格+/ 这也是我上一次测试没成的原因,这个很关键.
大家可以直接拿.htaccess文件来改
1.3.01规则
- 代码: 全选
[ISAPI_Rewrite]
##### NOTE: Replace /shop/ with the relative web path of your catalog in the "Rewrite Base" line below:
Options +FollowSymLinks
Options FollowSymLinks
AllowOverride All
RewriteEngine On
RewriteBase /
# From Ultimate SEO URLs
RewriteRule ^(.*)-p-(.*).html /index.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-c-(.*).html /index.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-m-([0-9]+).html /index.php?main_page=index&manufacturers_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pi-([0-9]+).html /index.php?main_page=popup_image&pID=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pr-([0-9]+).html /index.php?main_page=product_reviews&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pri-([0-9]+).html /index.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]
# For Open Operations Info Manager
RewriteRule ^(.*)-i-([0-9]+).html /index.php?main_page=info_manager&pages_id=$2&%{QUERY_STRING} [L]
# For dreamscape's News & Articles Manager
RewriteRule ^news/?$ index.php?main_page=news&%{QUERY_STRING} [L]
RewriteRule ^news/rss.xml /index.php?main_page=news_rss&%{QUERY_STRING} [L]
RewriteRule ^news/archive/? /index.php?main_page=news_archive&%{QUERY_STRING} [L]
RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html /index.php?main_page=news&date=$1-$2-$3&%{QUERY_STRING} [L]
RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html /index.php?main_page=news_archive&date=$1-$2&%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+)-comments.html /index.php?main_page=news_comments&article_id=$2&%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+).html /index.php?main_page=news_article&article_id=$2&%{QUERY_STRING} [L]
# All other pages
# Don't rewrite real files or directories
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html /index.php?main_page=$1&%{QUERY_STRING} [L]
1.2.7规则
- 代码: 全选
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# OLD SEO URLS
# Give a 301 to real URL (which Ultimate SEO will give a 301 to new SEO URL)
# You can remove the following if you were not using the breakmyzencart.com SEFU prior to installing this one
# BEGIN SAFE REMOVE
RewriteRule ^(.*)pages-main/category-(.*)/page-([0-9]+)/sort-(.*)/(.*).html index.php?main_page=index&cPath=$2&page=$3&sort=$4&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-main/category-(.*)/(.*).html index.php?main_page=index&cPath=$2&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-productinfo/category-(.*)/product-(.*)/(.*).html index.php?main_page=product_info&cPath=$2&products_id=$3&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-productinfo/product-(.*)/(.*).html index.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-product_reviews_info/product-(.*)/reviews_id-([0-9]+)/(.*).html index.php?main_page=product_reviews_info&products_id=$2&reviews_id=$3&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-info_manager/pages_id-([0-9]+)/(.*).html index.php?main_page=info_manager&pages_id=$2&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-product_music_info/product-(.*)/(.*).html index.php?main_page=product_music_info&products_id=$2&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-(.*)/index.html index.php?main_page=$2&%{QUERY_STRING} [L,R=301]
# END SAFE REMOVE
# From Ultimate SEO URLs
RewriteRule ^(.*)-p-(.*).html$ index.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-c-(.*).html$ index.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-m-([0-9]+).html$ index.php?main_page=index&manufacturers_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pi-([0-9]+).html$ index.php?main_page=popup_image&pID=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pr-([0-9]+).html$ index.php?main_page=product_reviews&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pri-([0-9]+).html$ index.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pmi-([0-9]+).html$ index.php?main_page=product_music_info&products_id=$2&%{QUERY_STRING} [L]
# For Open Operations Info Manager
RewriteRule ^(.*)-i-([0-9]+).html$ index.php?main_page=info_manager&pages_id=$2&%{QUERY_STRING} [L]
# For dreamscape's News & Articles Manager
RewriteRule ^news/?$ index.php?main_page=news&%{QUERY_STRING} [L]
RewriteRule ^news/rss.xml$ index.php?main_page=news_rss&%{QUERY_STRING} [L]
RewriteRule ^news/archive/?$ index.php?main_page=news_archive&%{QUERY_STRING} [L]
RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html$ index.php?main_page=news&date=$1-$2-$3&%{QUERY_STRING} [L]
RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html$ index.php?main_page=news_archive&date=$1-$2&%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+)-comments.html$ index.php?main_page=news_comments&article_id=$2&%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+).html$ index.php?main_page=news_article&article_id=$2&%{QUERY_STRING} [L]
# All other pages
# Don't rewrite real files or directories
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html$ index.php?main_page=$1&%{QUERY_STRING} [L]
方法B.修改部分文件,暂时只适用于1.2.7
http://www.intaa.net/~gato/zencart_user_friendly_urls/
一。修改/includes/configure.php.
追加红色部分
define('USE_PCONNECT', 'true'); // use persistent connections? or false
define('STORE_SESSIONS', 'db'); // leave empty '' for default handler or set to 'db'
define('USER_FRIENDLY_URLS_REWRITE', 'true');
二。修改/includes/functions/html_output.php
- 代码: 全选
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | license@zen-cart.com so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: html_output.php 1631 2005-07-24 19:29:52Z drbyte $
//
/**
* @package ZenCart_Functions
*/
////
// The HTML href link wrapper function
function zen_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true) {
global $request_type, $session_started, $http_domain, $https_domain;
if (!zen_not_null($page)) {
die('</td></tr></table></td></tr></table><br /><br /><strong class="note">Error!<br /><br />Unable to determine the page link!</strong><br /><br />');
}
if ($connection == 'NONSSL') {
$link = HTTP_SERVER;
} elseif ($connection == 'SSL') {
if (ENABLE_SSL == 'true') {
$link = HTTPS_SERVER ;
} else {
$link = HTTP_SERVER;
}
} else {
die('</td></tr></table></td></tr></table><br /><br /><strong class="note">Error!<br /><br />Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL</strong><br /><br />');
}
if ($use_dir_ws_catalog) $link .= DIR_WS_CATALOG;
if (!$static) {
if (zen_not_null($parameters)) {
if ((USER_FRIENDLY_URLS_REWRITE == 'true') &&
(!ereg('language', $parameters)) &&
(!ereg('manufacturers_id', $parameters)) &&
(!ereg('contact_us', $page)) &&
(!ereg('review', $page)) &&
(!ereg('review', $parameters))
) {
$parameters = str_replace('&sort=', '/sort', $parameters);
$parameters = str_replace('&page=', '/page', $parameters);
$parameters = str_replace('&filter_id=', '/filter', $parameters);
$parameters = str_replace('disp_order=', 'display', $parameters);
if (($page == "index") && (ereg('cPath', $parameters))){
$cnum = str_replace('cPath=', 'cid', $parameters);
$parameters = str_replace("cPath=", "categories/", $parameters);
$link .= $parameters . '.html';
require("url_data.php");
if ($urlrpl[$cnum] != NULL) {
$link = ereg_replace("categories/[0-9_]{1,}", "categories/$urlrpl[$cnum]", $link);
}
}
elseif (($page == "product_info") && (ereg('products_id', $parameters))){
$pnum = str_replace('products_id=', 'pid', $parameters);
$pnum = ereg_replace('cPath=[0-9_]{1,}&', '', $pnum);
$parameters = str_replace("products_id=", "products/", $parameters);
$parameters = ereg_replace('cPath=([0-9_]{1,})&', '', $parameters);
$parameters = str_replace('action=notify&','notify', $parameters);
$parameters = str_replace('action=add_product&','add', $parameters);
$parameters = str_replace('&reviews_id=','review/', $parameters);
$parameters = str_replace('&action=notify_remove','notify_remove', $parameters);
$parameters = str_replace('&action=notify','notify', $parameters);
$link .= $parameters . '.html';
require("url_data.php");
if ($urlrpl[$pnum] != NULL) {
$link = ereg_replace("products/[0-9]{1,}", "products/$urlrpl[$pnum]", $link);
}
}
elseif ($page == 'redirect') {
if (ereg('banner', $parameters)){
$parameters = str_replace('action=banner&goto=', 'redirect_banner', $parameters);
$link .= $parameters . '.html';
}
if (ereg('url', $parameters)){
$parameters = str_replace('action=url&goto=', 'redirect_url/', $parameters);
$parameters = str_replace('%2F', '/', $parameters);
$link = $parameters;
}
}
elseif ($page == 'tell_a_friend') {
$parameters = str_replace('to_email_address=','/to_', $parameters);
$parameters = str_replace('products_id=','/products', $parameters);
$parameters = str_replace('action=process&','/send', $parameters);
$link .= $page . $parameters . '.html';
}
elseif (
($page == "products_all") or
($page == "products_new") or
($page == "featured_products") or
($page == "specials)")
){
$link .= $page ."/" . $parameters . '.html';
} else {
$link .= 'index.php?main_page='. $page . "&" . zen_output_string($parameters);
}
} else {
$link .= 'index.php?main_page='. $page . "&" . zen_output_string($parameters);
}
} else {
if (USER_FRIENDLY_URLS_REWRITE == 'true') {
if (
($page == 'login') or
($page == 'advanced_search') or
($page == 'specials') or
($page == 'featured_products') or
($page == 'products_new') or
($page == 'products_all') or
($page == 'shippinginfo') or
($page == 'privacy') or
($page == 'conditions') or
($page == 'contact_us') or
($page == 'gv_faq') or
($page == 'site_map') or
($page == 'logoff') or
($page == 'account') or
($page == 'shopping_cart') or
($page == 'popup_shipping_estimator') or
($page == 'news_manager_all_news') or
($page == 'unsubscribe') or
($page == 'reviews') or
($page == 'checkout_shipping')
){
$link .= $page . ".html";
} else {
$link .= 'index.php?main_page=' . $page;
}
} else {
$link .= 'index.php?main_page=' . $page;
}
}
} else {
if (zen_not_null($parameters)) {
$link .= $page . "?" . zen_output_string($parameters);
} else {
$link .= $page;
}
}
$separator = '&';
while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);
// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
if (defined('SID') && zen_not_null(SID)) {
$sid = SID;
// } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL_ADMIN == 'true') ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
} elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == 'true') ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
if ($http_domain != $https_domain) {
$sid = zen_session_name() . '=' . zen_session_id();
}
}
}
// clean up the link before processing
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
$link = str_replace('&', '/', $link);
$link = str_replace('?', '/', $link);
$link = str_replace('&', '/', $link);
$link = str_replace('=', '/', $link);
$separator = '?';
}
if (isset($sid)) {
$link .= $separator . $sid;
}
// clean up the link after processing
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
$link = ereg_replace('&', '&', $link);
return $link;
}
// use when proportional images is turned off or from a template directory
////
// The HTML image wrapper function
function zen_image_OLD($src, $alt = '', $width = '', $height = '', $parameters = '') {
global $template_dir;
//auto replace with defined missing image
if ($src == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
$src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
}
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
return false;
}
// if not in current template switch to template_default
if (!file_exists($src)) {
$src = str_replace(DIR_WS_TEMPLATES . $template_dir, DIR_WS_TEMPLATES . 'template_default', $src);
}
// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="' . zen_output_string($src) . '" border="0" alt="' . zen_output_string($alt) . '"';
if (zen_not_null($alt)) {
$image .= ' title=" ' . zen_output_string($alt) . ' "';
}
if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
if ($image_size = @getimagesize($src)) {
if (empty($width) && zen_not_null($height)) {
$ratio = $height / $image_size[1];
$width = $image_size[0] * $ratio;
} elseif (zen_not_null($width) && empty($height)) {
$ratio = $width / $image_size[0];
$height = $image_size[1] * $ratio;
} elseif (empty($width) && empty($height)) {
$width = $image_size[0];
$height = $image_size[1];
}
} elseif (IMAGE_REQUIRED == 'false') {
return false;
}
}
if (zen_not_null($width) && zen_not_null($height)) {
$image .= ' width="' . zen_output_string($width) . '" height="' . zen_output_string($height) . '"';
}
if (zen_not_null($parameters)) $image .= ' ' . $parameters;
$image .= ' />';
return $image;
}
////
// The HTML image wrapper function
function zen_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
global $template_dir;
// soft clean the alt tag
$alt = zen_clean_html($alt);
// use old method on template images
if (strstr($src, 'includes/templates') or strstr($src, 'includes/languages') or PROPORTIONAL_IMAGES_STATUS == '0') {
return zen_image_OLD($src, $alt, $width, $height, $parameters);
}
//auto replace with defined missing image
if ($src == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
$src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
}
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
return false;
}
// if not in current template switch to template_default
if (!file_exists($src)) {
$src = str_replace(DIR_WS_TEMPLATES . $template_dir, DIR_WS_TEMPLATES . 'template_default', $src);
}
// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="' . zen_output_string($src) . '" border="0" alt="' . zen_output_string($alt) . '"';
if (zen_not_null($alt)) {
$image .= ' title=" ' . zen_output_string($alt) . ' "';
}
if ( ((CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height))) ) {
if ($image_size = @getimagesize($src)) {
if (empty($width) && zen_not_null($height)) {
$ratio = $height / $image_size[1];
$width = $image_size[0] * $ratio;
} elseif (zen_not_null($width) && empty($height)) {
$ratio = $width / $image_size[0];
$height = $image_size[1] * $ratio;
} elseif (empty($width) && empty($height)) {
$width = $image_size[0];
$height = $image_size[1];
}
} elseif (IMAGE_REQUIRED == 'false') {
return false;
}
}
if (zen_not_null($width) && zen_not_null($height) and file_exists($src)) {
// $image .= ' width="' . zen_output_string($width) . '" height="' . zen_output_string($height) . '"';
// proportional images
$image_size = @getimagesize($src);
// fix division by zero error
$ratio = ($image_size[0] != 0 ? $width / $image_size[0] : 1);
if ($image_size[1]*$ratio > $height) {
$ratio = $height / $image_size[1];
$width = $image_size[0] * $ratio;
} else {
$height = $image_size[1] * $ratio;
}
$image .= ' width="' . $width . '" height="' . $height . '"';
} else {
// override on missing image to allow for proportional and required/not required
if (IMAGE_REQUIRED == 'false') {
return false;
} else {
$image .= ' width="' . SMALL_IMAGE_WIDTH . '" height="' . SMALL_IMAGE_HEIGHT . '"';
}
}
if (zen_not_null($parameters)) $image .= ' ' . $parameters;
$image .= ' />';
return $image;
}
////
// The HTML form submit button wrapper function
// Outputs a button in the selected language
function zen_image_submit($image, $alt = '', $parameters = '') {
global $template, $current_page_base;
$image_submit = '<input type="image" src="' . zen_output_string($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image) . '" alt="' . zen_output_string($alt) . '"';
if (zen_not_null($alt)) $image_submit .= ' title=" ' . zen_output_string($alt) . ' "';
if (zen_not_null($parameters)) $image_submit .= ' ' . $parameters;
$image_submit .= ' />';
return $image_submit;
}
////
// Output a function button in the selected language
function zen_image_button($image, $alt = '', $parameters = '') {
global $template, $current_page_base;
return zen_image($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image, $alt, '', '', $parameters);
}
////
// Output a separator either through whitespace, or with an image
function zen_draw_separator($image = 'true', $width = '100%', $height = '1') {
// set default to use from template - zen_image will translate if not found in current template
if ($image == 'true') {
$image = DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_BLACK_SEPARATOR;
} else {
if (!strstr($image, DIR_WS_TEMPLATE_IMAGES)) {
$image = DIR_WS_TEMPLATE_IMAGES . $image;
}
}
return zen_image($image, '', $width, $height);
}
////
// Output a form
function zen_draw_form($name, $action, $method = 'post', $parameters = '') {
$form = '<form name="' . zen_output_string($name) . '" action="' . zen_output_string($action) . '" method="' . zen_output_string($method) . '"';
if (zen_not_null($parameters)) $form .= ' ' . $parameters;
$form .= '>';
return $form;
}
////
// Output a form input field
function zen_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) {
$field = '<input type="' . zen_output_string($type) . '" name="' . zen_output_string($name) . '"';
if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
} elseif (zen_not_null($value)) {
$field .= ' value="' . zen_output_string($value) . '"';
}
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= ' />';
return $field;
}
////
// Output a form password field
function zen_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {
return zen_draw_input_field($name, $value, $parameters, 'password', true);
}
////
// Output a selection field - alias function for zen_draw_checkbox_field() and zen_draw_radio_field()
function zen_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {
$selection = '<input type="' . zen_output_string($type) . '" name="' . zen_output_string($name) . '"';
if (zen_not_null($value)) $selection .= ' value="' . zen_output_string($value) . '"';
if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {
$selection .= ' checked="checked"';
}
if (zen_not_null($parameters)) $selection .= ' ' . $parameters;
$selection .= ' />';
return $selection;
}
////
// Output a form checkbox field
function zen_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {
return zen_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);
}
////
// Output a form radio field
function zen_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {
return zen_draw_selection_field($name, 'radio', $value, $checked, $parameters);
}
////
// Output a form textarea field
function zen_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
$field = '<textarea name="' . zen_output_string($name) . '" wrap="' . zen_output_string($wrap) . '" cols="' . zen_output_string($width) . '" rows="' . zen_output_string($height) . '"';
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= '>';
if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
$field .= stripslashes($GLOBALS[$name]);
} elseif (zen_not_null($text)) {
$field .= $text;
}
$field .= '</textarea>';
return $field;
}
////
// Output a form hidden field
function zen_draw_hidden_field($name, $value = '', $parameters = '') {
$field = '<input type="hidden" name="' . zen_output_string($name) . '"';
if (zen_not_null($value)) {
$field .= ' value="' . zen_output_string($value) . '"';
} elseif (isset($GLOBALS[$name])) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
}
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= ' />';
return $field;
}
////
// Output a form file-field
function zen_draw_file_field($name, $required = false) {
$field = zen_draw_input_field($name, '', ' size="50" ', 'file');
return $field;
}
////
// Hide form elements
function zen_hide_session_id() {
global $session_started;
if ( ($session_started == true) && defined('SID') && zen_not_null(SID) ) {
return zen_draw_hidden_field(zen_session_name(), zen_session_id());
}
}
////
// Output a form pull down menu
function zen_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
$field = '<select name="' . zen_output_string($name) . '"';
if (zen_not_null($parameters)) $field .= ' ' . $parameters;
$field .= '>';
if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);
for ($i=0, $n=sizeof($values); $i<$n; $i++) {
$field .= '<option value="' . zen_output_string($values[$i]['id']) . '"';
if ($default == $values[$i]['id']) {
$field .= ' selected="selected"';
}
$field .= '>' . zen_output_string($values[$i]['text'], array('"' => '"', ''' => ''', '<' => '<', '>' => '>')) . '</option>';
}
$field .= '</select>';
if ($required == true) $field .= TEXT_FIELD_REQUIRED;
return $field;
}
////
// Creates a pull-down list of countries
function zen_get_country_list($name, $selected = '', $parameters = '') {
$countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$countries = zen_get_countries();
for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
$countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
}
return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
}
?>
规则
- 代码: 全选
RewriteEngine on
RewriteBase /
RewriteRule ^categories/Hardware.html /index.php?main_page=index&cPath=1 [L]
RewriteRule ^categories/Graphics_Cards.html /index.php?main_page=index&cPath=1_4 [L]
RewriteRule ^categories/Keyboards.html /index.php?main_page=index&cPath=1_8 [L]
RewriteRule ^categories/Mice.html /index.php?main_page=index&cPath=1_9 [L]
RewriteRule ^products/Matrox_G200_MMS.html /index.php?main_page=product_info&products_id=1 [L]
RewriteRule ^products/Microsoft_Internet_Keyboard_PS2.html /index.php?main_page=product_info&products_id=25 [L]
RewriteRule ^products/Microsoft_IntelliMouse_Explorer.html /index.php?main_page=product_info&products_id=26 [L]
RewriteRule ^products/(.*)notify_remove.html /index.php?main_page=product_info&products_id=$1&action=notify_remove [L]
RewriteRule ^products/(.*)notify.html /index.php?main_page=product_info&products_id=$1&action=notify [L]
RewriteRule ^products/(.*)add.html /index.php?main_page=product_info&products_id=$1&action=add_product [L]
RewriteRule ^products/(.*).html /index.php?main_page=product_info&products_id=$1 [L]
RewriteRule ^categories/(.*)/filter(.*)/page(.*)/sort(.*).html /index.php?main_page=index&cPath=$1&filter_id=$2&page=$3&sort=$4 [L]
RewriteRule ^categories/(.*)/sort(.*)/filter(.*)/page(.*).html /index.php?main_page=index&cPath=$1&sort=$2&filter_id=$3&page=$4 [L]
RewriteRule ^categories/(.*)/filter(.*)/sort(.*)/page(.*).html /index.php?main_page=index&cPath=$1&filter_id=$2&sort=$3&page=$4 [L]
RewriteRule ^categories/(.*)/sort(.*)/filter(.*).html /index.php?main_page=index&cPath=$1&sort=$2&filter_id=$3 [L]
RewriteRule ^categories/(.*)/sort(.*)/page(.*).html /index.php?main_page=index&cPath=$1&sort=$2&page=$3 [L]
RewriteRule ^categories/(.*)/page(.*)/sort(.*).html /index.php?main_page=index&cPath=$1&page=$2&sort=$3 [L]
RewriteRule ^categories/(.*).html /index.php?main_page=index&cPath=$1 [L]
RewriteRule ^order/(.*).html /index.php?main_page&action=buy_now&products_id=$1 [L]
RewriteRule ^(.*)/display(.*)/page(.*).html /index.php?main_page=$1&disp_order=$2&page=$3 [L]
RewriteRule ^shippinginfo.html /index.php?main_page=shippinginfo [L]
RewriteRule ^privacy.html /index.php?main_page=privacy [L]
RewriteRule ^conditions.html /index.php?main_page=conditions [L]
RewriteRule ^contact_us.html /index.php?main_page=contact_us [L]
RewriteRule ^gv_faq.html /index.php?main_page=gv_faq [L]
RewriteRule ^specials.html /index.php?main_page=specials [L]
RewriteRule ^featured_products.html /index.php?main_page=featured_products [L]
RewriteRule ^products_new.html /index.php?main_page=products_new [L]
RewriteRule ^products_all.html /index.php?main_page=products_all [L]
RewriteRule ^tell_a_friend/to_(.*)/products(.*).html /index.php?main_page=tell_a_friend&to_email_address=$1&products_id=$2 [L]
RewriteRule ^tell_a_friend/send/products(.*).html /index.php?main_page=tell_a_friend&action=process&products_id=$1 [L]
RewriteRule ^tell_a_friend/products(.*).html /index.php?main_page=tell_a_friend&products_id=$1 [L]
RewriteRule ^manufacturers_id(.*).html /index.php?main_page=index&manufacturers_id=$1 [L]
RewriteRule ^redirect/manufacturers_id(.*).html /index.php?main_page=redirect&action=manufacturer&manufacturers_id=$1 [L]
RewriteRule ^redirect_banner(.*).html /index.php?main_page=redirect&action=banner&goto=$1 [L]
RewriteRule ^redirect_url/(.*) /index.php?main_page=redirect&action=url&goto=$1 [L]
RewriteRule ^login.html /index.php?main_page=login [L]
RewriteRule ^logoff.html /index.php?main_page=logoff [L]
RewriteRule ^account.html /index.php?main_page=account [L]
RewriteRule ^shopping_cart.html /index.php?main_page=shopping_cart [L]
RewriteRule ^checkout_shipping.html /index.php?main_page=checkout_shipping [L]
RewriteRule ^advanced_search.html /index.php?main_page=advanced_search [L]
RewriteRule ^popup_shipping_estimator.html /index.php?main_page=popup_shipping_estimator [L]
RewriteRule ^news/(.*).html /index.php?main_page=news_manager&pages_id=$1 [L]
RewriteRule ^news_manager_all_news.html /index.php?main_page=news_manager_all_news [L]
RewriteRule ^unsubscribe.html /index.php?main_page=unsubscribe [L]
RewriteRule ^reviews.html /index.php?main_page=reviews [L]
RewriteRule ^index.html$ /index.php?main_page=index [L]
最后注意html_output.php的修改
其中有类似'index.php?main_page这样的语句,“?”号都要加“\”这样就不会出现不能注册的了





News