1 / 3
Caption Text
2 / 3
Caption Two
3 / 3
Caption Three margin testing

Sunday, December 6, 2009

Google Analytics推出异步跟踪分析

Google Analytics推出异步跟踪分析-月光博客

  据Google Code博客报道,Google宣布推出Google Analytics异步跟踪模式,用来提高使用Google Analytics的用户体验,提高用户的访问速度。

  新的代码具有以下优点:

  1、网页能更快地加载跟踪代码,改善浏览器加载时间。

  2、增强数据收集的准确性。

  3、消除因JavaScript代码未完全加载而差生的错误。

  这里是新的统计跟踪代码示例

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();

</script>

  异步跟踪代码的第一部分分配了_gaq变量的JavaScript数组,此后,两个API调用将编码后的数据写入此数组,当跟踪代码初始化的时候,它把数组_gaq的数据加载到一个新的对象中,并执行跟踪API调用此数组中的初始数据,因此,使用这样的代码,可以将所有跟踪统计所需要的数据全部存储下来,即使Google Analytics的代码还没有下载完,因此就不必再担心ga.js跟踪代码的依赖性问题了。

  该代码的下半部分动态创建了一个script元素,并设置好合适的地址,因此,大多数浏览器将在另一个script代码中加载跟踪代码,以减少网页加载时间。

  一旦代码被加载,就会将_gaq数组转换为一个谷歌分析的_gaq对象,该队形做为基础的_gat对象执行所有命令,将数据发送到用户的Google Analytics账户。

  新的异步跟踪代码正处于测试阶段,可供所有的Google Analytics用户使用,这个代码是可选项,原有的Google Analytics代码依旧工作正常,不过,如果你想要提高你网站的速度并增加分析数据的准确性,建议使用这个新代码。该代码的开发文件参见这里,示例参见这里

Friday, December 4, 2009

Google推出免费DNS服务

Google推出免费DNS服务-月光博客

  据Google官方博客报道,Google推出了一个名为"Google Public DNS"的域名解析系统,允许用户免费使用Google的服务器解析网络域名,以加快上网速度,改善网络用户的浏览体验,提高安全性和有效性。

  DNS(Domain Name System)是域名解析服务器的意思,它在互联网的作用是把域名转换成为网络可以识别的IP地址。当用户在浏览器中输入网址域名时,首先就会访问系统设置的DNS域名解析服务器(通常由ISP运营商如电信、联通提供)。如果该服务器内保存着该域名对应的IP信息,则直接返回该信息供用户访问网站。否则,就会向上级DNS逐层查找该域名的对应数据。

  目前国内上网用户普遍使用的是默认DNS服务器,即电信运营商的DNS服务,这带来一个巨大的风险,就是DNS劫持。目前国内电信运营商普遍采用DNS劫持的方法,干扰用户正常上网,例如,当用户访问一个不存在(或者被封)的网站,电信运营商就会把用户劫持到一个满屏都是广告的页面:电信114互联星空网站,这个114网站不仅搜索质量低劣,而且广告众多,极大的影响了用户上网的安全性和浏览体验。后来,电信运营商的胆子越来越大,甚至连Google的网站电信都敢劫持,这进一步证明了电信运营商的DNS服务可靠性是多么糟糕。

电信114互联星空

电信114互联星空的页面

  因此,我以前曾经强烈建议网友使用国外DNS解析服务器,例如OpenDNS的免费DNS服务,他们的DNS为208.67.222.222和208.67.220.220,以免被中国电信劫持。

  但OpenDNS有两个缺点,一是OpenDNS的服务器在美国,使用的人多了有可能会速度变慢,没有国内的DNS速度快,二是OpenDNS的IP地址不太好记,容易忘。

  现在,中国网民的福音终于到了,Google面对大众推出了免费的公共DNS系统,Google表示推出免费DNS的主要目的就是为了改进网络浏览速度,为此Google对DNS服务器技术进行了改进,通过采用预获取技术提升性能,同时保证DNS服务的安全性和准确性。

  普通用户要使用Google DNS非常简单,因为Google为他们的DNS服务器选择了两个非常简单易记的IP地址:"8.8.8.8"和"8.8.4.4"。用户只要在系统的网络设置中选择这两个地址为DNS服务器即可。使用方法非常简单,对于宽带拨号用户来说,在"设置"-"网络连接"中找到宽带上网的连接,打开网络连接属性,选择Interner协议(TCP/IP)的属性页里,不要选择自动获取DNS,而要选择"使用下面的DNS服务器地址",首选DNS服务器和备用DNS服务器分别设置为 8.8.8.8和8.8.4.4,如下图所示,完成后重新连接上网即可。

网络连接属性

网络连接属性

  Google提供的公共DNS服务与电信或OpenDNS的不同,当用户输入一个错误的或者不存在的网址的时候,不会像中国电信一般直接弹出一个满屏都是广告的页面,Google公司承诺绝不会重定或者过滤用户所访问的地址,而且绝无广告。对于OpenDNS用户来说,Google的技术雄厚,两个IP地址也很好记,并且不会显示广告,相信会有不少原先OpenDNS的用户会跳槽到Google DNS。

Wednesday, December 2, 2009

The Zen Cart Execution Process

The Zen Cart Execution Process

Zen Cart, like most open-source code, is a largly undocumented. Luckily for us, it also has a habit of mixing in much of it's program/application logic with it's actual HTML design, so it's not only undocumented, it's also hard to browse the HTML code. To top it off, it also has a dynamic template loader, which means that the program logic and HTML templates could be in any one of four different directories. Also undocumented, and of dubious usefullness.

The result is that it's not only difficult to browse through the program logic and HTML code, but you often don't even know which files are going to get loaded.

This document is an attempt to sort through the overarching structure of how Zen Cart tends to work.

index.php steps:

Here's where all of action begins.
  1. it loads 'includes/application_top.php'
  2. if $main_page isn't set, it gets set to 'index'
  3. if the directory 'includes/modules/pages/$main_page' doesn't exist, $main_page gets set to 'index'
  4. it loads all of the files starting with 'header_php' in 'includes/modules/pages/$main_page'
  5. now it loads 'html_header.php' from the first first place it finds it from the following directories
    1. includes/templates/mytemplate/$main_page/
    2. includes/templates/template_default/$main_page/
    3. includes/templates/mytemplate/common/
    4. includes/templates/template_default/common/
  6. now it does the same thing for finding and loading 'main_template_vars.php'
  7. now it does the same thing for finding and loading 'tpl_main_page.php'
  8. Finally it displays the '</html>' tag. Why display it here when the '<html>' tag is displayed somewhere else? Who knows.

application_top.php steps:

This file will load in all of general definitions used site-wide, initialize some site-wide classes ($template, $db) and do other general stuff.

html_header.php steps:

The default html_header.php file will simply create all of the HTML up to the </head> tag It loads 'includes/modules/meta_tags.php', which uses a bloated switch statement to figure out what the site's title, meta-keywords, and meta-description should be. It tries to find the css directory, and loads in it all stylesheets that begin with 'style' and end with '.css' It does the same thing for the jscript directory, and tries to load all files that begin with 'jscript_' and end with '.js'

main_template_vars.php steps:

it simply sets $body_code to the first of:
  1. includes/modules/pages/$main_page/main_template_vars.php
  2. includes/templates/mytemplate/$main_page/tpl_{$main_page}_default.php
  3. includes/templates/template_default/$main_page/tpl_{$main_page}_default.php
  4. includes/templates/mytemplate/templates/tpl_{$main_page}_default.php
  5. includes/templates/template_default/templates/tpl_{$main_page}_default.php
that's it.

tpl_main_page.php steps:

this file lays out the basic page.
  1. <body>
  2. loads the 'includes/modules/header.php' file
  3. if the left column is enabled, it loads 'includes/modules/column_left.php'
  4. it loads the file set in $body_code
  5. if the right column is enabled, it loads 'includes/modules/column_right.php'
  6. loads 'includes/modules/footer.php'
  7. </body>

includes/modules/pages/$main_page/main_template_vars.php steps:

this is where the meat of the actual content if loaded and displayed. it typically does all of the program logic first, sets all of the necessary variables, and then loads the template file. As usual, the template file is loaded from the first of the following:
  1. includes/templates/mytemplate/$main_page/
  2. includes/templates/template_default/$main_page/
  3. includes/templates/mytemplate/templates/
  4. includes/templates/template_default/templates/
The standard is that the template file will be named 'tpl_SOMENAME.php'. Note that it doesn't end with '_default.php'. The undocumented naming convention is that files that end with '_default.php' are files that get loaded with it can't find the 'includes/modules/pages/$main_page/main_template_vars.php' file.

tpl_{$main_page}_default.php steps:

If it doesn't find the above file and it instead finds a tpl_*_default.php file, then it means that all of the program logic and variables will be mixed up with the actual displayed HTML code. In Zen-Cart's defense, this generally means that there's not a lot of program logic to be had here, hardly any really, but it's still damn annoying to be mixing the program logic with design. No sir, I don't like it one bit.

Future Updates

Eventually this document will also cover the process by which the program loads in the language files, such as "english.php" and the content files like "privacy.php" and "conditions.php." The Zen Cart creators actually created these files with the idea that they would be a part of your custom template, which is a clear violation of the content/design seperation.

This document will also cover sideboxes (which requires a whole nother custom template directory). As an interesting sidenote, when you switch to a new template, all of the sideboxes get turned off. The level of user-unfriendliness of Zen Cart is amazing to me sometimes.

Zen Cart Database Schema

Developers - Database Schema - Zen Cart(tm) Wiki

address_book
address_format
admin
admin_activity_log
authorizenet
banners
banners_history
categories
categories_description
configuration *
configuration_group
counter
counter_history *
countries
coupons
coupons_description
coupon_email_track
coupon_gv_customer
coupon_gv_queue
coupon_redeem_track
coupon_restrict
currencies
customers
customers_basket
customers_basket_attributes
customers_info
customers_wishlist
db_cache
email_archive
ezpages
featured
files_uploaded
geo_zones
get_terms_to_filter
group_pricing
languages
layout_boxes
manufacturers
manufacturers_info
media_clips
media_manager
media_to_products
media_types
meta_tags_categories_description
meta_tags_products_description
music_genre
newsletters
orders *
orders_products *
orders_products_attributes *
orders_products_download *
orders_status
orders_status_history
orders_total *
paypal *
paypal_payment_status
paypal_payment_status_history *
paypal_session *
paypal_testing *
products *
products_attributes *
products_attributes_download *
products_description *
products_discount_quantity *
products_notifications
products_options *
products_options_types
products_options_values *
products_options_values_to_products_options *
products_to_categories *
product_music_extra *
product_types *
product_types_to_category *
product_type_layout *
project_version
project_version_history
query_builder *
record_artists *
record_artists_info *
record_company *
record_company_info *
reviews *
reviews_description *
salemaker_sales *
sessions *
specials *
tax_class *
tax_rates *
template_select *
upgrade_exceptions *
whos_online *
zones *
zones_to_geo_zones *

Friday, November 27, 2009

如何修改Zen-cart模板

如何修改Zen-cart模板(經典!!經典)_zen-cart网店开源系统,免费网店系统
2009-08-27 16:59

最近一直在调度zen-cart,找到了下面这篇文章,是关于如果修改zen cart模版的,很有用,,跟大家分享一下。

DIR_WS_CATALOG // zent cat目录 这些在includes/configure.php定义

meta_tags.php //定义网站的meta信息。这些是从数据库中取出来的。在includes/modules/下面

HTML_PARAMS //模板语言常量文件定义的。

$current_page_base 在includes/init_inicludes/init_sanitize.php $_GET['main_page']

manufacturers_id 生产厂商ID

product_id 产品ID

$tmp_pagename index_home
有加载modules/pages

======================
首页加载的文件
html_header.php

tpl_index_default.php {indeXDefaultMainContent 首页可以编辑}

tpl_modules_featured_products.php -> tpl_columnar_display.php
bannerOne banners [后台bannner控制]

logo 修改 tpl_header.php 页面 在模板的images/logo.gif

id="mainwrapper"

common/tpl_header.php 功能:所有页面的页眉 基本可以不用或者广告用

id="headerwrapper"

navColumnOnewrapper

navEZpagesTOp 简易页面的连接

左边分类在 templates/模板/sideboxes/下面 sql参数在categories.php
=============================

1. 在首页顶部增加连接的方法。
找到模板文件夹下面的zcen/tpl_header.php
在#topbarwrap与#topbar 增加一个<div>连接</div> 里面写上你要的连接

2. Logo的替换。这个在后台是没有的。在语包的文件里定义。
找到languages/english/zcen/header.php 找到Header_logo_image 常量 修改
或者 替换 模板下面的 logo.gif文件/includes/templates/zcen/images/logo.gif

3. 导航栏的东西〔这个后台的设计的)
样式调节#navEZPagesTop
后台的 参数调整:0 1 2
后台的 ezpage设置

4. 首页分类名称的修改
打开 /templates/languages/english.php
找到:define("BOX_HEADING_CATEGORIES","CATEGORIES")
改为:define("BOX_HEADING_CATEGORIES","Select you game");
主`
D:\WEB\zen-cart\includes\templates\classic\css\stylesheet.css
整个页面组织
D:\WEB\zen-cart\includes\templates\template_default\common\tpl_main_page.php
网页左右栏width源代码:<td id="navColumnOne" class="columnLeft" style="width: 150px;">
动态调用width: <?php echo COLUMN_WIDTH_LEFT; ?>">,
在后台-configuration-layout里可以更改Column Width/

Column Width – Left Boxes
商品分类名称Categories更改:BOX_HEADING_CATEGORIES,
"D:\WEB\zen-cart\includes\languages\english.php"(78,11): define('BOX_HEADING_CATEGORIES', 'Categories');

spooer名称更改:define('BOX_HEADING_BANNER_BOX','Sponsors')
默认模板,左spooner对应'BOX_HEADING_BANNER_BOX' 右上spooer对'BOX_HEADING_BANNER_BOX_ALL'
右下spooer对应BOX_HEADING_BANNER_BOX2

左边栏处理:只保留includes\templates\template_default\sideboxes\tpl_categories.php,在里面增加
图片链接

右边栏的处理:
1.后台设置为保留who's onlie(sideboxes/whos_online.php),
与之对应的 tpl_box_default_right.php,查找<?php echo $title; ?>进行替换

2.添加左边栏目内容,对tpl_box_default_right.php更改:

中部修改:
===========
\includes\templates\template_default\templates\tpl_index_default.php

去掉顶部说明:<?php if (SHOW_CUSTOMER_GREETING == 1) { ?>
<h2 class="greeting"><?php echo zen_customer_greeting(); ?></h2>
<?php } ?>

去掉欢迎信息:
<h1 id="indexDefaultHeading"><?php echo HEADING_TITLE; ?></h1>

去掉顶部导航:
\includes\templates\template_default\common\tpl_main_page.php
<div id="navBreadCrumb"><?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?></div>
模板顶部修改:
==========
\zen-cart\includes\templates\template_default\common

\tpl_header.php
<div id="navMain"></div>内可增加链接
<?php
/**
* prepares and displays header output
*
*/
if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_HEADER_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or

$_SESSION['customer_id'] == ")) {
$flag_disable_header = true;
}
require($template->get_template_dir('tpl_header.php',DIR_WS_
TEMPLATE, $current_page_base,'common'). '/tpl_header.php');?>

上段从<div id="mainWrapper">抽出,放在它前面做全屏导航版块
顶部搜索按钮修改:
\includes\templates\template_default\common\tpl_header.php :
<div id="navMainSearch"><?php require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?></div>
自动生成导航栏:
\includes\templates\template_default\templates\
tpl_modules_categories_tabs.php
将其代码掏空,重新添加导航代码:
~~~~~~~~~~~~~~~~~~~~~~~~~
<?php
/**
* Module Template – categories_tabs
*
* Template stub used to display categories-tabs output
*
* @package templateSystem
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_modules_categories_tabs.php 3395 2006-04-08 21:13:00Z ajeh $
*/

include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_CATEGORIES_TABS));
?>
<?php if (CATEGORIES_TABS_STATUS ==

'1′ && sizeof($links_list) >= 1) { ?>
<div id="navCatTabsWrapper">
<div id="navCatTabs">
<ul>
<?php for ($i=0, $n=sizeof($links_list); $i<$n; $i++) { ?>
<li><?php echo $links_list[$i];?></li>
<?php } ?>
</ul>
</div>
</div>
<?php } ?>
~~~~~~~~~~~~~~~~~~~~~~

的log背景:
\zen-cart\includes\templates\template_default\common

\tpl_header.php
<div id="tagline"><?php echo HEADER_SALES_TEXT;?></div>
底部导航修改:
\includes\templates\template_default\common\tpl_main_page.php
<div id="bannerSix" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>


提高Google Adsense广告相关度的技巧

提高Google Adsense广告相关度的技巧-月光博客

  昨天在听AdSense的一个网络会议的时候,主讲人提到了一个提高Adsense广告相关度的技巧,可供那些感觉广告匹配度不高、广告点击率低的AdSense用户参考使用。

  Google AdSense广告通常会针对用户网页的内容自动显示广告,但AdSense可能并不清楚你网页上的哪些部门的内容更重要,如果用户通过手动添加一些HTML代码的方式,突出或忽略网页中的某些部分,这在一定程度上可以引导AdSense抓取工具重点分析网页的某些部分或忽略某些部分,以提高广告的相关度。

  比如,用户想要强调网页上某部分,那么可以在这部门的前后增加下面两段HTML代码。

  <!-- google_ad_section_start -->

  <!-- google_ad_section_end -->

  将需要强调的部分放在这两段代码中间即可。

  如果用户想要忽略掉从某处开始的信息,可以在那个位置前增加下面的HTML代码。

  <!-- google_ad_section_start(weight=ignore) -->

  经过这些处理后,AdSense广告的相关度就会得到一定的提高。

  不过,如果用户页面的内容不足,那么有可能会因为没有广告内容而显示公益广告。

Thursday, November 26, 2009

怎么去修改zen cart 程序

以下是zen cart 首页程序的修改。根据各个文件修改不同的功能。希望这些能对你有所帮助。

首页界面://include/templates/zccn/common/tpl_main_page.php
首页主样式表://include/templates/zccn/css/schinese_stylesheet.css

首页左边栏目:
/includes/templates/template_default/common/tpl_box_default_left.php

商品分类内容修改:
/includes/modules/sideboxes/categories.php
/includes/templates/zccn/sideboxes/tpl_categories.php

推荐产品
/includes/modules/sideboxes/featured.php
/includes/templates/template_default/sideboxes/tpl_featured.php

新进产品
/includes/modules/sideboxes/whats_new.php
/includes/templates/template_default/sideboxes/tpl_whats_new.php

特价产品
/includes/modules/sideboxes/specials.php
/includes/templates/template_default/sideboxes/tpl_specials.php

数据库表
/includes/database_tables.php

首页中间商品修改:
/includes/templates/template_default/common/main_template_vars.php
/includes/templates/template_default/templates/tpl_index_default.php

内页中间商品修改:
/includes/templates/template_default/templates/tpl_index_catergories.php

首页中间 August新进商品
/includes/templates/template_default/templates/tpl_modules_whats_new.php

首页中间 August特价商品
/includes/templates/template_default/templates/tpl_modules_specials_default.php

首页中间 推荐商品
/includes/templates/template_default/templates/tpl_modules_featured_products.php

首页右边栏目:
/includes/templates/template_default/common/tpl_box_default_right.php

商品搜索
/includes/templates/template_default/sideboxes/tpl_search.php

客服中心
/includes/templates/template_default/sideboxes/tpl_ezpages.php

畅销商品
/includes/templates/template_default/sideboxes/tpl_best_sellers.php

商品评论
/includes/templates/template_default/sideboxes/tpl_reviews_write.php

在线名单
/includes/templates/template_default/sideboxes/tpl_whos_online.php

Featured Post

Windows和Ubuntu双系统完全独立的安装方法

http://www.ubuntuhome.com/windows-and-ubuntu-install.html  | Ubuntu Home Posted by Snow on 2012/06/25 安装Windows和Ubuntu双系统时,很多人喜欢先安装windows,然...