holy shit

寺夺喜从天降

zencart常用表单模块

搜索模块:search_form.php

<?php
/**
 * search_form.php -- modules
 */
$output_form = "";
$output_form .= zen_draw_form('quick_find_header', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get');
$output_form .= zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
$output_form .= zen_draw_hidden_field('search_in_description', '1') . zen_hide_session_id();
$output_form .= zen_draw_input_field('keyword', '', 'value="' . HEADER_SEARCH_DEFAULT_TEXT . '" onfocus="if (this.value == \'' . HEADER_SEARCH_DEFAULT_TEXT . '\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'' . HEADER_SEARCH_DEFAULT_TEXT . '\';"');
$output_form .= zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
$output_form .= '<input type="submit" value="' . HEADER_SEARCH_BUTTON . '" style="width: 45px" />';
$output_form .= "</form>";

echo $output_form;
?>

货币选择模块:currency_form.php
<?php
/**
 * currency_from.php  - modules
 */
$show_currencies= false;
if (substr($current_page, 0, 8) != 'checkout') {
	$show_currencies= true;
}

if ($show_currencies == true) {
	if (isset($currencies) && is_object($currencies)) {
		reset($currencies->currencies);
		$currencies_array = array();
		while (list($key, $value) = each($currencies->currencies)) {
			$currencies_array[] = array('id' => $key, 'text' => $value['title']);
		}
		$hidden_get_variables = '';
		reset($_GET);
		while (list($key, $value) = each($_GET)) {
			if ( ($key != 'currency') && ($key != zen_session_name()) && ($key != 'x') && ($key != 'y') ) {
				$hidden_get_variables .= zen_draw_hidden_field($key, $value);
			}
		}

		$output_currency_from = "";
		$output_currency_from .= zen_draw_form('currencies_form', zen_href_link(basename(preg_replace('/.php/','', $PHP_SELF)), '', $request_type, false), 'get');
		$output_currency_from .= zen_draw_pull_down_menu('currency', $currencies_array, $_SESSION['currency'], 'onchange="this.form.submit();"') . $hidden_get_variables . zen_hide_session_id();
		$output_currency_from .= '</form>';
		echo $output_currency_from;
	}
}
?>

posted @ 2011-04-23 18:34  潜水鱼  阅读(2011)  评论(0)    收藏  举报

holy shit on foot