<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>寒风网</title>
	<atom:link href="http://www.coolwinds.cn/feed" rel="self" type="application/rss+xml" />
	<link>http://www.coolwinds.cn</link>
	<description>ToMoRRow CoMes NeVer.</description>
	<lastBuildDate>Sat, 31 Mar 2012 04:30:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>datatables高级应用之服务端处理数据</title>
		<link>http://www.coolwinds.cn/article/design/1421.htm</link>
		<comments>http://www.coolwinds.cn/article/design/1421.htm#comments</comments>
		<pubDate>Sat, 31 Mar 2012 04:30:40 +0000</pubDate>
		<dc:creator>寒风</dc:creator>
				<category><![CDATA[网站建设]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[datatables]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqli]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false">http://www.coolwinds.cn/?p=1421</guid>
		<description><![CDATA[<a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>如果对datatables还不熟悉的童鞋，可以参考<a title="寒风" href="http://www.coolwinds.cn" target="_blank">寒风</a>的前两篇博文：
<blockquote>1.<a title="datatables手册" href="http://www.coolwinds.cn/article/design/1384.htm" target="_blank"> jquery分页插件datatables各参数详细说明及简单应用</a>

2.<a title="datatables的ajax应用" href="http://www.coolwinds.cn/article/design/1412.htm" target="_blank">datatables之ajax的应用</a></blockquote>
<a title="寒风" href="http://www.coolwinds.cn" target="_blank">寒风</a>在第一篇文章里面的结尾有个实例，但仅适用于数据量小的情况，数据量大了咋办呢？就需要在服务端处理数据了：]]></description>
			<content:encoded><![CDATA[<p>如果对<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/datatables" title="查看 datatables 中的全部文章" target="_blank">datatables</a></span>还不熟悉的童鞋，可以参考<a title="寒风" href="http://www.coolwinds.cn" target="_blank">寒风</a>的前两篇博文：</p>
<blockquote><p>1.<a title="datatables手册" href="http://www.coolwinds.cn/article/design/1384.htm" target="_blank"> jquery分页插件datatables各参数详细说明及简单应用</a></p>
<p>2.<a title="datatables的ajax应用" href="http://www.coolwinds.cn/article/design/1412.htm" target="_blank">datatables之ajax的应用</a></p></blockquote>
<p><a title="寒风" href="http://www.coolwinds.cn" target="_blank">寒风</a>在第一篇文章里面的结尾有个实例，但仅适用于数据量小的情况，数据量大了咋办呢？就需要在服务端处理数据了：</p>
<p>http://www.<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/datatables" title="查看 datatables 中的全部文章" target="_blank">datatables</a></span>.net/release-datatables/examples/<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/ajax" title="查看 ajax 中的全部文章" target="_blank">ajax</a></span>/<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/ajax" title="查看 ajax 中的全部文章" target="_blank">ajax</a></span>.html</p>
<p>前端server.html：<br />
核心代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$(document).ready(function() {
$('#example').dataTable( {
&quot;bProcessing&quot;: true, //数据加载中的提示
&quot;bServerSide&quot;: true, //开启服务端处理模式
&quot;sAjaxSource&quot;: &quot;server_<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/mysql" title="查看 mysql 中的全部文章" target="_blank">mysql</a></span>i.php&quot; //<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/ajax" title="查看 ajax 中的全部文章" target="_blank">ajax</a></span>请求数据来源
//&quot;sServerMethod&quot;: &quot;GET&quot; //修改默认传参方式
} );
} );</pre></td></tr></table></div>

<p>tbody里面不写，或者：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;tr&gt;
    &lt;td colspan=&quot;5&quot; class=&quot;dataTables_empty&quot;&gt;正在从服务器加载数据...&lt;/td&gt;
&lt;/tr&gt;</pre></td></tr></table></div>

<p>完整示例：<br />
服务端server_<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/mysql" title="查看 mysql 中的全部文章" target="_blank">mysql</a></span>i.php改自datatables官方演示代码，不同之处是换成了<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/mysqli" title="查看 mysqli 中的全部文章" target="_blank">mysqli</a></span>，加了部分注释：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* 部分公用变量 */</span>
<span style="color: #000088;">$aColumns</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'ID'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'time'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'num'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'times'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'deplet'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//查询的字段</span>
<span style="color: #000088;">$sIndexColumn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ID&quot;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//count总数据用</span>
<span style="color: #000088;">$sTable</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;table&quot;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//查询的表单</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* 数据库连接 */</span>
<span style="color: #000088;">$<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/mysqli" title="查看 mysqli 中的全部文章" target="_blank">mysqli</a></span></span><span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> mysqli<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;database&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET NAMES utf8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* 分页用，limit 【iDisplayStart,iDisplayLength】*/</span>
<span style="color: #000088;">$sLimit</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'iDisplayStart'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'iDisplayLength'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'-1'</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$sLimit</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;LIMIT &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'iDisplayStart'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">.</span>
		<span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'iDisplayLength'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//mysql_real_escape_string转义特殊字符</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* 排序用，order 【iSortingCols,iSortCol_*,sSortDir_*】*/</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'iSortCol_0'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$sOrder</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ORDER BY  &quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>intval<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'iSortingCols'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span><span style="color: #666666; font-style: italic;">//iSortingCols大于1时，多列排序时用，单列iSortingCols=1只有iSortCol_0和sSortDir_0</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span> <span style="color: #0000ff;">'bSortable_'</span><span style="color: #339933;">.</span><span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'iSortCol_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;true&quot;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$sOrder</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$aColumns</span><span style="color: #009900;">&#91;</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'iSortCol_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;
			 	&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sSortDir_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//iSortCol_*排序字段，sSortDir_*为DESC或ASC</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$sOrder</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$sOrder</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$sOrder</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;ORDER BY&quot;</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$sOrder</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* 条件查询，顶部search过滤用 where .. like 【sSearch】*/</span>
<span style="color: #000088;">$sWhere</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sSearch'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$sWhere</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;WHERE (&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$aColumns</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$sWhere</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$aColumns</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; LIKE '%&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sSearch'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;%' OR &quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$sWhere</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$sWhere</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">3</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$sWhere</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">')'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* 各列过滤用 where .. like 【bSearchable_*,sSearch_*】 */</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$aColumns</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bSearchable_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;true&quot;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sSearch_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//如果第i列开启了查询，且查询内容不为空</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$sWhere</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$sWhere</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;WHERE &quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$sWhere</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; AND &quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$sWhere</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$aColumns</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; LIKE '%&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sSearch_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;%' &quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* 数据查询，显示数据用 */</span>
<span style="color: #000088;">$sQuery</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;
	SELECT SQL_CALC_FOUND_ROWS &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; , &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$aColumns</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;
	FROM <span style="color: #006699; font-weight: bold;">$sTable</span>
	<span style="color: #006699; font-weight: bold;">$sWhere</span>
	<span style="color: #006699; font-weight: bold;">$sOrder</span>
	<span style="color: #006699; font-weight: bold;">$sLimit</span>
&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$rResult</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$sQuery</span> <span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* 获取过滤后的条数 */</span>
<span style="color: #000088;">$sQuery</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT FOUND_ROWS()&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$rResultFilterTotal</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$sQuery</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$aResultFilterTotal</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$rResultFilterTotal</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$iFilteredTotal</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$aResultFilterTotal</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* 获取数据总数 */</span>
<span style="color: #000088;">$sQuery</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT COUNT(&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$sIndexColumn</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;) FROM <span style="color: #006699; font-weight: bold;">$sTable</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$rResultTotal</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$sQuery</span> <span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$aResultTotal</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$rResultTotal</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$iTotal</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$aResultTotal</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* 获取输出结果 */</span>
<span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">&quot;sEcho&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sEcho'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">//当前第多少条</span>
	<span style="color: #0000ff;">&quot;iTotalRecords&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$iTotal</span><span style="color: #339933;">,</span>    <span style="color: #666666; font-style: italic;">//总计多少条</span>
	<span style="color: #0000ff;">&quot;iTotalDisplayRecords&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$iFilteredTotal</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">//过滤后多少条</span>
	<span style="color: #0000ff;">&quot;aaData&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>   <span style="color: #666666; font-style: italic;">//数据内容</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$aRow</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$rResult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$aColumns</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$aRow</span><span style="color: #009900;">&#91;</span> <span style="color: #000088;">$aColumns</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$output</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aaData'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$output</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>其实也是通过ajax请求数据，只是在服务端做分页排序等等~</p>
<ul class="related_post"><li><a href="http://www.coolwinds.cn/article/design/1412.htm" title="datatables之ajax的应用">datatables之ajax的应用</a></li><li><a href="http://www.coolwinds.cn/article/design/1384.htm" title="jquery分页插件datatables各参数详细说明及简单应用">jquery分页插件datatables各参数详细说明及简单应用</a></li><li><a href="http://www.coolwinds.cn/article/free/1367.htm" title="小巧的mysql数据库php管理工具phpMiniAdmin 1.7.111025寒风汉化版">小巧的mysql数据库php管理工具phpMiniAdmin 1.7.111025寒风汉化版</a></li><li><a href="http://www.coolwinds.cn/article/wp/1251.htm" title="代码高亮插件WP-Syntax应用与修改">代码高亮插件WP-Syntax应用与修改</a></li><li><a href="http://www.coolwinds.cn/article/wp/872.htm" title="WP插件推荐：wordpress-tencent-microblog，腾讯微博调用插件">WP插件推荐：wordpress-tencent-microblog，腾讯微博调用插件</a></li><li><a href="http://www.coolwinds.cn/article/life/804.htm" title="终于下雨了！">终于下雨了！</a></li><li><a href="http://www.coolwinds.cn/article/wp/585.htm" title="Wordpress插件推荐：Auto Highslide，超炫图片效果">Wordpress插件推荐：Auto Highslide，超炫图片效果</a></li><li><a href="http://www.coolwinds.cn/article/wp/543.htm" title="Wordpress插件推荐：Akismet，反垃圾评论利器">Wordpress插件推荐：Akismet，反垃圾评论利器</a></li><li><a href="http://www.coolwinds.cn/article/wp/488.htm" title="Wordpress插件推荐：wp-cumulus，超酷标签">Wordpress插件推荐：wp-cumulus，超酷标签</a></li><li><a href="http://www.coolwinds.cn/article/design/206.htm" title="EasyPHP3.0的数据库连接密码、账户设置及如何导出数据设置">EasyPHP3.0的数据库连接密码、账户设置及如何导出数据设置</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.coolwinds.cn/article/design/1421.htm/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>datatables之ajax的应用</title>
		<link>http://www.coolwinds.cn/article/design/1412.htm</link>
		<comments>http://www.coolwinds.cn/article/design/1412.htm#comments</comments>
		<pubDate>Tue, 06 Mar 2012 09:01:42 +0000</pubDate>
		<dc:creator>寒风</dc:creator>
				<category><![CDATA[网站建设]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[datatables]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false">http://www.coolwinds.cn/?p=1412</guid>
		<description><![CDATA[<a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>前面一篇文章<a href="http://www.coolwinds.cn/article/design/1384.htm">jquery分页插件datatables各参数详细说明及简单应用</a><a href="http://www.coolwinds.cn" title="寒风网" target="_blank">寒风</a>简单的介绍了一些datatables插件的参数设置，今天是他的ajax应用。
1. AjaxSource为本地文件（仅为值）,关键词：bProcessing,sAjaxSource,sAjaxDataProp
http://www.datatables.net/release-datatables/examples/ajax/ajax.html
1> tbody留空
2> 	
<pre line='1' lang='html'>$(document).ready(function() {
    var oTable=$('#example').dataTable({
        "bProcessing": true,  //是否显示Processing，默认为false
        "sAjaxSource": "arrays.txt"  //这个不用解释了吧
        "sAjaxDataProp": "demo"  //默认json数据名为aaData，可通过sAjaxDataProp进行修改
    });
} );</pre>
arrays.txt的json数据格式如：http://www.datatables.net/release-datatables/examples/ajax/sources/arrays.txt，必须与列数对应，名为aaData 。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>前面一篇文章<a href="http://www.coolwinds.cn/article/design/1384.htm">jquery分页插件datatables各参数详细说明及简单应用</a><a href="http://www.coolwinds.cn" title="寒风网" target="_blank">寒风</a>简单的介绍了一些datatables插件的参数设置，今天是他的ajax应用。<br />
1. AjaxSource为本地文件（仅为值）,关键词：bProcessing,sAjaxSource,sAjaxDataProp</p>
<p>http://www.<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/datatables" title="查看 datatables 中的全部文章" target="_blank">datatables</a></span>.net/release-<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/datatables" title="查看 datatables 中的全部文章" target="_blank">datatables</a></span>/examples/<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/ajax" title="查看 ajax 中的全部文章" target="_blank">ajax</a></span>/<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/ajax" title="查看 ajax 中的全部文章" target="_blank">ajax</a></span>.html</p>
<p>1> tbody留空<br />
2></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$(document).ready(function() {
    var oTable=$('#example').dataTable({
        &quot;bProcessing&quot;: true,  //是否显示Processing，默认为false
        &quot;sAjaxSource&quot;: &quot;arrays.txt&quot;  //这个不用解释了吧
        &quot;sAjaxDataProp&quot;: &quot;demo&quot;  //默认json数据名为aaData，可通过sAjaxDataProp进行修改
    });
} );</pre></td></tr></table></div>

<p>arrays.txt的json数据格式如：http://www.data<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/table" title="查看 table 中的全部文章" target="_blank">table</a></span>s.net/release-data<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/table" title="查看 table 中的全部文章" target="_blank">table</a></span>s/examples/ajax/sources/arrays.txt，必须与列数对应，名为aaData 。</p>
<p>2. AjaxSource带（数组），关键词：aoColumns</p>
<p>http://www.data<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/table" title="查看 table 中的全部文章" target="_blank">table</a></span>s.net/release-datatables/examples/ajax/objects.html</p>
<p>前端：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;aoColumns&quot;: [
            { &quot;mDataProp&quot;: &quot;engine&quot; },
            { &quot;mDataProp&quot;: &quot;browser&quot; },
            { &quot;mDataProp&quot;: &quot;platform&quot; },
            { &quot;mDataProp&quot;: &quot;version&quot; },
            { &quot;mDataProp&quot;: &quot;grade&quot; }
        ]</pre></td></tr></table></div>

<p>请求所得数据类似：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">{
  &quot;aaData&quot;: [
    {
      &quot;engine&quot;: &quot;Trident&quot;,
      &quot;browser&quot;: &quot;Internet Explorer 4.0&quot;,
      &quot;platform&quot;: &quot;Win 95+&quot;,
      &quot;version&quot;: &quot;4&quot;,
      &quot;grade&quot;: &quot;X&quot;
    },
    {
      &quot;engine&quot;: &quot;Trident&quot;,
      &quot;browser&quot;: &quot;Internet Explorer 5.0&quot;,
      &quot;platform&quot;: &quot;Win 95+&quot;,
      &quot;version&quot;: &quot;5&quot;,
      &quot;grade&quot;: &quot;C&quot;
    },
    {
      &quot;engine&quot;: &quot;Trident&quot;,
      &quot;browser&quot;: &quot;Internet Explorer 5.5&quot;,
      &quot;platform&quot;: &quot;Win 95+&quot;,
      &quot;version&quot;: &quot;5.5&quot;,
      &quot;grade&quot;: &quot;A&quot;
    },
    {
      &quot;engine&quot;: &quot;Trident&quot;,
      &quot;browser&quot;: &quot;Internet Explorer 6&quot;,
      &quot;platform&quot;: &quot;Win 98+&quot;,
      &quot;version&quot;: &quot;6&quot;,
      &quot;grade&quot;: &quot;A&quot;
    }
]}</pre></td></tr></table></div>

<p>3. AjaxSource为向服务端请求的数据（仅为值）</p>
<p>http://www.datatables.net/release-datatables/examples/ajax/ajax.html</p>
<p>简单示例：<br />
ajax.html:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">	$(document).ready(function() {
	    var oTable=$('#example').dataTable({
			&quot;bProcessing&quot;: true,
			&quot;sAjaxSource&quot;: &quot;ajax.php&quot;
		});
	} );</pre></td></tr></table></div>

<p>ajax.php:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$mysqli</span><span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> mysqli<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;database&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET NAMES utf8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT ID,time,num,times,deplet FROM `table` LIMIT 100&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;查询出错！&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$str</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'{&quot;aaData&quot;:['</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//构建数据用</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rows</span><span style="color: #339933;">=</span><span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$str</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">'[&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$rows</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ID'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$rows</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$rows</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'num'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$rows</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'times'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$rows</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'deplet'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;],'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$str</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">']}'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$str</span><span style="color: #339933;">=</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">',]}'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">']}'</span><span style="color: #339933;">,</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//去掉最末端的逗号</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$str</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>4. 允许某列请求的数据有为空的数据，关键词：aoColumns</p>
<p>http://www.datatables.net/release-datatables/examples/ajax/null_data_source.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;aoColumns&quot;: [
            null,
            null,
            null,
            null,
            null,
            { &quot;mDataProp&quot;: null } //允许第六列为空
            ]</pre></td></tr></table></div>

<p>5. 数组里面包含子数组的情况，关键词：aoColumns</p>
<p>http://www.datatables.net/release-datatables/examples/ajax/objects_subarrays.html</p>
<p>请求得到的数据如：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">{
  &quot;aaData&quot;: [
    {
      &quot;engine&quot;: &quot;Trident&quot;,
      &quot;browser&quot;: &quot;Internet Explorer 4.0&quot;,
      &quot;platform&quot;: &quot;Win 95+&quot;,
      &quot;details&quot;: [
        &quot;4&quot;,
        &quot;X&quot;
      ]
    },
    {
      &quot;engine&quot;: &quot;Trident&quot;,
      &quot;browser&quot;: &quot;Internet Explorer 5.0&quot;,
      &quot;platform&quot;: &quot;Win 95+&quot;,
      &quot;details&quot;: [
        &quot;5&quot;,
        &quot;C&quot;
      ]
    },
    {
      &quot;engine&quot;: &quot;Trident&quot;,
      &quot;browser&quot;: &quot;Internet Explorer 5.5&quot;,
      &quot;platform&quot;: &quot;Win 95+&quot;,
      &quot;details&quot;: [
        &quot;5.5&quot;,
        &quot;A&quot;
      ]
    }
]}</pre></td></tr></table></div>

<p>前端代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;aoColumns&quot;: [
            { &quot;mDataProp&quot;: &quot;engine&quot; },
            { &quot;mDataProp&quot;: &quot;browser&quot; },
            { &quot;mDataProp&quot;: &quot;platform&quot; },
            { &quot;mDataProp&quot;: &quot;details.0&quot; },  //details里面的第一个值
            { &quot;mDataProp&quot;: &quot;details.1&quot; }   //details里面的第二个值
        ]
/*
多级类似：
&quot;aoColumns&quot;: [
            { &quot;mDataProp&quot;: &quot;engine&quot; },
            { &quot;mDataProp&quot;: &quot;browser&quot; },
            { &quot;mDataProp&quot;: &quot;platform.inner&quot; },
            { &quot;mDataProp&quot;: &quot;platform.details.0&quot; },
            { &quot;mDataProp&quot;: &quot;platform.details.1&quot; }
            ]
*/</pre></td></tr></table></div>

<ul class="related_post"><li><a href="http://www.coolwinds.cn/article/design/1421.htm" title="datatables高级应用之服务端处理数据">datatables高级应用之服务端处理数据</a></li><li><a href="http://www.coolwinds.cn/article/design/1384.htm" title="jquery分页插件datatables各参数详细说明及简单应用">jquery分页插件datatables各参数详细说明及简单应用</a></li><li><a href="http://www.coolwinds.cn/article/wp/1251.htm" title="代码高亮插件WP-Syntax应用与修改">代码高亮插件WP-Syntax应用与修改</a></li><li><a href="http://www.coolwinds.cn/article/wp/872.htm" title="WP插件推荐：wordpress-tencent-microblog，腾讯微博调用插件">WP插件推荐：wordpress-tencent-microblog，腾讯微博调用插件</a></li><li><a href="http://www.coolwinds.cn/article/life/804.htm" title="终于下雨了！">终于下雨了！</a></li><li><a href="http://www.coolwinds.cn/article/wp/585.htm" title="Wordpress插件推荐：Auto Highslide，超炫图片效果">Wordpress插件推荐：Auto Highslide，超炫图片效果</a></li><li><a href="http://www.coolwinds.cn/article/wp/543.htm" title="Wordpress插件推荐：Akismet，反垃圾评论利器">Wordpress插件推荐：Akismet，反垃圾评论利器</a></li><li><a href="http://www.coolwinds.cn/article/wp/488.htm" title="Wordpress插件推荐：wp-cumulus，超酷标签">Wordpress插件推荐：wp-cumulus，超酷标签</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.coolwinds.cn/article/design/1412.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery分页插件datatables各参数详细说明及简单应用</title>
		<link>http://www.coolwinds.cn/article/design/1384.htm</link>
		<comments>http://www.coolwinds.cn/article/design/1384.htm#comments</comments>
		<pubDate>Tue, 28 Feb 2012 11:37:38 +0000</pubDate>
		<dc:creator>寒风</dc:creator>
				<category><![CDATA[网站建设]]></category>
		<category><![CDATA[datatables]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[分页]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false">http://www.coolwinds.cn/?p=1384</guid>
		<description><![CDATA[<a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>貌似很久没有更新博客了，实在太忙。。。
最近<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>用到一个jquery分页插件，刚拿到手时完全摸不着头脑，网上的中文资料几乎木有，于是花了点时间研究了一下，将以下分享出来，可以说是一个简单的datatables的中文手册了。可能文章会很长，但都是<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>一个字一个字打出来的，都经过实践了滴，嘿嘿~
以下一些参数等基本是按照官方示例来的，比较多，还木有完全弄完，以后有机会再更新。
<blockquote>简介：Datatables是一款强大的jquery分页插件，不但具备分页功能，还可进行数据搜索过滤、排序等功能。
当前最新版本：v1.9.0
下载地址：
http://www.datatables.net/download/
http://115.com/file/dp5u9szo</blockquote>

<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>提醒：下载后，将media文件夹里面的css，images，js文件夹拷贝到你的网站即可。接下来引入以下内容：
<pre lang="html" line="1"><style type="text/css" title="currentStyle">
	@import "./style/datatable/css/demo_page.css";
	@import "./style/datatable/css/demo_table.css";
</style>
<script type="text/javascript" src="./style/datatable/js/jquery.js"></script>
<script type="text/javascript" src="./style/datatable/js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
	    $('#example').dataTable();//其中example为table的id，table中必须有thead！
	} );
</script></pre>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>貌似很久没有更新博客了，实在太忙。。。<br />
最近<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>用到一个<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/jquery" title="查看 jquery 中的全部文章" target="_blank">jquery</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e5%88%86%e9%a1%b5" title="查看 分页 中的全部文章" target="_blank">分页</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%8f%92%e4%bb%b6" title="查看 插件 中的全部文章" target="_blank">插件</a></span>，刚拿到手时完全摸不着头脑，网上的中文资料几乎木有，于是花了点时间研究了一下，将以下分享出来，可以说是一个简单的<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/datatables" title="查看 datatables 中的全部文章" target="_blank">datatables</a></span>的中文手册了。可能文章会很长，但都是<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>一个字一个字打出来的，都经过实践了滴，嘿嘿~<br />
以下一些参数等基本是按照官方示例来的，比较多，还木有完全弄完，以后有机会再更新。</p>
<blockquote><p>简介：Data<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/table" title="查看 table 中的全部文章" target="_blank">table</a></span>s是一款强大的<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/jquery" title="查看 jquery 中的全部文章" target="_blank">jquery</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e5%88%86%e9%a1%b5" title="查看 分页 中的全部文章" target="_blank">分页</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%8f%92%e4%bb%b6" title="查看 插件 中的全部文章" target="_blank">插件</a></span>，不但具备分页功能，还可进行数据搜索过滤、排序等功能。<br />
当前最新版本：v1.9.0<br />
下载地址：</p>
<p>http://www.<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/datatables" title="查看 datatables 中的全部文章" target="_blank">datatables</a></span>.net/download/</p>
<p>http://115.com/file/dp5u9szo</p></blockquote>
<p><a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>提醒：下载后，将media文件夹里面的css，images，js文件夹拷贝到你的网站即可。接下来引入以下内容：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;style type=&quot;text/css&quot; title=&quot;currentStyle&quot;&gt;
	@import &quot;./style/data<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/table" title="查看 table 中的全部文章" target="_blank">table</a></span>/css/demo_page.css&quot;;
	@import &quot;./style/data<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/table" title="查看 table 中的全部文章" target="_blank">table</a></span>/css/demo_table.css&quot;;
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;./style/datatable/js/<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/jquery" title="查看 jquery 中的全部文章" target="_blank">jquery</a></span>.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;./style/datatable/js/jquery.dataTables.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	$(document).ready(function() {
	    $('#example').dataTable();//其中example为table的id，table中必须有thead！
	} );
&lt;/script&gt;</pre></td></tr></table></div>

<p>1. <span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/datatables" title="查看 datatables 中的全部文章" target="_blank">datatables</a></span>简单示例</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/zero_config.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$(document).ready(function() {
$('#example').dataTable();
} );</pre></td></tr></table></div>

<p>这个是不进行参数配置，效果如下图：</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/02/默认参数_1.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1386" title="默认参数" src="http://www.coolwinds.cn/wp-content/uploads/2012/02/默认参数_1-300x144.jpg" alt="" width="300" height="144" /></a></p>
<p>2. 进行基本参数配置</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/filter_only.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;bPaginate&quot;: true, //翻页功能
&quot;bLengthChange&quot;: true, //改变每页显示数据数量
&quot;bFilter&quot;: true, //过滤功能
&quot;bSort&quot;: true, //排序功能
&quot;bInfo&quot;: true,//页脚信息
&quot;bAutoWidth&quot;: true,//自动宽度</pre></td></tr></table></div>

<p><a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>说明：以上参数配置实现的显示效果和第一个是一样的。<br />
3. 默认排序设置，aaSorting</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/table_sorting.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;aaSorting&quot;: [[ 4, &quot;desc&quot; ]],//设置第5个元素为默认排序</pre></td></tr></table></div>

<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/02/修改默认排序_1.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1390" title="修改默认排序" src="http://www.coolwinds.cn/wp-content/uploads/2012/02/修改默认排序_1-300x145.jpg" alt="" width="300" height="145" /></a></p>
<p>4. 多个datatable</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/multiple_tables.html</p>
<p><a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>说明：<br />
将表单id改为class：<br />
初始化：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">$('.example').dataTable(</pre></td></tr></table></div>

<p>即可。<br />
5. 隐藏部分列的内容，aoColumnDefs</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/hidden_columns.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;aoColumnDefs&quot;: [
{ &quot;bSearchable&quot;: false, &quot;bVisible&quot;: false, &quot;aTargets&quot;: [ 2 ] },//bSearchable：是否可搜索；bVisible：是否可见；aTargets：哪一列
{ &quot;bVisible&quot;: false, &quot;aTargets&quot;: [ 3 ] }//
]</pre></td></tr></table></div>

<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/02/屏蔽部分列_1.jpg" class="highslide-image" onclick="return hs.expand(this);"><img title="屏蔽部分列" src="http://www.coolwinds.cn/wp-content/uploads/2012/02/屏蔽部分列_1-300x144.jpg" alt="" width="300" height="144" /></a></p>
<p>6. 修改表单各元素显示位置</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/dom.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;sDom&quot;: '&lt;&quot;top&quot;i&gt;rt&lt;&quot;bottom&quot;flp&gt;&lt;&quot;clear&quot;&gt;'</pre></td></tr></table></div>

<p>表示的html为：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;top&quot;&gt;这里显示 当前条数，总共条数&lt;/div&gt;
这里显示 请求中的提示信息，表单内容
&lt;div class=&quot;bottom&quot;&gt;这里显示 搜索框，每页数量选择，翻页按钮&lt;/div&gt;
&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
&nbsp;
//l - 每页数量选择select
//f – 搜索框search
//t – 表单内容table
//i – 当前条数，总共条数information
//p – 翻页按钮pagination
//r – 请求中的提示信息
//&lt; 和 &gt; – 一个div的开始与结束
//&lt;&quot;class&quot;&gt; – class为div的class名称</pre></td></tr></table></div>

<p>7. 保存当前页面信息为cookie，默认关闭</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/state_save.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;bStateSave&quot;: true</pre></td></tr></table></div>

<p>如果用户关闭页面后重新打开该页面，该列表会和关闭前的状态完全一样（长度，过滤，分页和排序）</p>
<p>8. 修改默认分页显示样式</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/alt_pagination.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;sPaginationType&quot;: &quot;full_numbers&quot;</pre></td></tr></table></div>

<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/02/修改默认分页显示样式_1.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1389" title="修改默认分页显示样式" src="http://www.coolwinds.cn/wp-content/uploads/2012/02/修改默认分页显示样式_1-300x135.jpg" alt="" width="300" height="135" /></a></p>
<p>9. x轴宽度限制</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/scroll_x.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;sScrollX&quot;: &quot;100%&quot;,
&quot;sScrollXInner&quot;: &quot;110%&quot;,
&quot;bScrollCollapse&quot;: true</pre></td></tr></table></div>

<p>用的很少</p>
<p>10. y轴高度限制</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/scroll_y.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;sScrollY&quot;: &quot;200px&quot;,
&quot;bPaginate&quot;: false //该参数为是否显示分页，如果设置为true貌似就没什么意义了</pre></td></tr></table></div>

<p>11. x轴、y轴均限制</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/scroll_xy.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;sScrollY&quot;: 200,
&quot;sScrollX&quot;: &quot;100%&quot;,
&quot;sScrollXInner&quot;: &quot;110%&quot;</pre></td></tr></table></div>

<p>12. 应用主题</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/themes.html</p>
<p>需要拷贝examples/examples_support/themes文件夹到style/datatable里面</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">@import &quot;./style/datatable/css/demo_table.css&quot;;</pre></td></tr></table></div>

<p>替换为：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">@import &quot;./style/datatable/css/demo_table_jui.css&quot;;
主题一：
引入&lt;pre lang=&quot;html&quot; line=&quot;1&quot;&gt;@import &quot;./style/datatable/themes/smoothness/jquery-ui-1.8.4.custom.css&quot;;</pre></td></tr></table></div>

<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/02/应用主题_1.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1391" title="应用主题" src="http://www.coolwinds.cn/wp-content/uploads/2012/02/应用主题_1-300x138.jpg" alt="" width="300" height="138" /></a><br />
主题二：<br />
引入</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">@import &quot;./style/datatable/themes/ui-lightness/jquery-ui-1.8.4.custom.css&quot;;</pre></td></tr></table></div>

<p>主题二是橘色系的，木有第一个smoothness好看，这里就不截图了！</p>
<p>13. 语言设置</p>
<p>http://www.datatables.net/release-datatables/examples/basic_init/language.html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;oLanguage&quot;: {
&quot;sLengthMenu&quot;: &quot;每页显示 _MENU_条&quot;,
&quot;sZeroRecords&quot;: &quot;没有找到符合条件的数据&quot;,
&quot;sProcessing&quot;: &quot;&amp;lt;img src=’./loading.gif’ /&amp;gt;&quot;,
&quot;sInfo&quot;: &quot;当前第 _START_ - _END_ 条　共计 _TOTAL_ 条&quot;,
&quot;sInfoEmpty&quot;: &quot;木有记录&quot;,
&quot;sInfoFiltered&quot;: &quot;(从 _MAX_ 条记录中过滤)&quot;,
&quot;sSearch&quot;: &quot;搜索：&quot;,
&quot;oPaginate&quot;: {
&quot;sFirst&quot;: &quot;首页&quot;,
&quot;sPrevious&quot;: &quot;前一页&quot;,
&quot;sNext&quot;: &quot;后一页&quot;,
&quot;sLast&quot;: &quot;尾页&quot;
}
}</pre></td></tr></table></div>

<p>也可以直接指定语言包，txt文件：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&quot;sUrl&quot;: &quot;media/language/de_DE.txt&quot; //文件格式和上面一样</pre></td></tr></table></div>

<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/02/语言设置_1.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1392" title="语言设置" src="http://www.coolwinds.cn/wp-content/uploads/2012/02/语言设置_1-300x138.jpg" alt="" width="300" height="138" /></a></p>
<p>14. 各列数据input过滤</p>
<p>http://www.datatables.net/release-datatables/examples/api/multi_filter.html</p>
<p>最前面加入：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">var asInitVals = new Array();
$('#example').dataTable 修改为：var oTable =$('#example').dataTable
加入：
/*过滤代码开始*/
$(&quot;tfoot input&quot;).keyup( function () {
oTable.fnFilter( this.value, $(&quot;tfoot input&quot;).index(this) );
} );
$(&quot;tfoot input&quot;).each( function (i) {
asInitVals[i] = this.value;
} );
$(&quot;tfoot input&quot;).focus( function () {
if ( this.className == &quot;search_init&quot; )
{
this.className = &quot;&quot;;
this.value = &quot;&quot;;
}
} );
$(&quot;tfoot input&quot;).blur( function (i) {
if ( this.value == &quot;&quot; )
{
this.className = &quot;search_init&quot;;
this.value = asInitVals[$(&quot;tfoot input&quot;).index(this)];
}
} );</pre></td></tr></table></div>

<p>tfoot里面加入：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;tr&gt;
    &lt;th&gt;&lt;input type=&quot;text&quot; name=&quot;search_engine&quot; value=&quot;Search engines&quot; class=&quot;search_init&quot; /&gt;&lt;/th&gt;
    &lt;th&gt;&lt;input type=&quot;text&quot; name=&quot;search_browser&quot; value=&quot;Search browsers&quot; class=&quot;search_init&quot; /&gt;&lt;/th&gt;
    &lt;th&gt;&lt;input type=&quot;text&quot; name=&quot;search_platform&quot; value=&quot;Search platforms&quot; class=&quot;search_init&quot; /&gt;&lt;/th&gt;
    &lt;th&gt;&lt;input type=&quot;text&quot; name=&quot;search_version&quot; value=&quot;Search versions&quot; class=&quot;search_init&quot; /&gt;&lt;/th&gt;
    &lt;th&gt;&lt;input type=&quot;text&quot; name=&quot;search_grade&quot; value=&quot;Search grades&quot; class=&quot;search_init&quot; /&gt;&lt;/th&gt;
&lt;/tr&gt;</pre></td></tr></table></div>

<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/02/搜索次数为19的结果_1.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1388" title="搜索次数为19的结果" src="http://www.coolwinds.cn/wp-content/uploads/2012/02/搜索次数为19的结果_1-300x219.jpg" alt="" width="300" height="219" /></a></p>
<p>15. 每一行点击详情效果</p>
<p>http://www.datatables.net/release-datatables/examples/api/row_details.html</p>
<p>在最前面引入函数：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">/* 构造每一行详情的函数 fnFormatDetails*/
function fnFormatDetails ( oTable, nTr ){
    var aData = oTable.fnGetData( nTr );
    var sOut = '&lt;table cellpadding=&quot;6&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; style=&quot;padding-left:50px;&quot;&gt;'; //在这里定义要返回的内容
    sOut += '&lt;tr&gt;&lt;td&gt;Rendering engine:&lt;/td&gt;&lt;td&gt;'+aData[1]+' '+aData[4]+'&lt;/td&gt;&lt;/tr&gt;';
    sOut += '&lt;tr&gt;&lt;td&gt;Link to source:&lt;/td&gt;&lt;td&gt;Could provide a link here&lt;/td&gt;&lt;/tr&gt;';
    sOut += '&lt;tr&gt;&lt;td&gt;Extra info:&lt;/td&gt;&lt;td&gt;And any further details here (images etc)&lt;/td&gt;&lt;/tr&gt;';
    sOut += '&lt;/table&gt;';
    return sOut;
}</pre></td></tr></table></div>

<p>ready(function)里面开头加入：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">/*显示每一行详情用_start*/
var nCloneTh = document.createElement( 'th' );
var nCloneTd = document.createElement( 'td' );
nCloneTd.innerHTML = '&lt;img src=&quot;./style/datatable/images/details_open.png&quot;&gt;';
nCloneTd.className = &quot;center&quot;;
$('#example thead tr').each( function () {
    this.insertBefore( nCloneTh, this.childNodes[0] );
} );
$('#example tbody tr').each( function () {
    this.insertBefore(  nCloneTd.cloneNode( true ), this.childNodes[0] );
} );
/*显示每一行详情用_end*/</pre></td></tr></table></div>

<p>ready(function)里面末尾加入：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">/*加入展开，收缩每一行详情按钮用*/
$('#example tbody td img').live('click', function () {
    var nTr = $(this).parents('tr')[0];
    if ( oTable.fnIsOpen(nTr) )
    {
        this.src = &quot;./style/datatable/images/details_open.png&quot;;
        oTable.fnClose( nTr );
    }
    else
    {
        this.src = &quot;./style/datatable/images/details_close.png&quot;;
        oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
    }
} );</pre></td></tr></table></div>

<p>值得注意的是，如果加入了tfoot，必须手动在里面加入多一行th！</p>
<p><b>最后，是<a href="http://www.coolwinds.cn" title="寒风网" target="_blank">寒风</a>写的简单的php+mysql+datatables的简单示例，很多<a href="http://www.coolwinds.cn" title="寒风网" target="_blank">寒风</a>都做了详细的注释说明：</b></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #000088;">$mysqli</span><span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> mysqli<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;database&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET NAMES utf8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM `table` limit 500&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;查询出错！&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;style type=&quot;text/css&quot; title=&quot;currentStyle&quot;&gt;
	@import &quot;./style/datatable/css/demo_page.css&quot;;
	@import &quot;./style/datatable/css/demo_table_jui.css&quot;;
	@import &quot;./style/datatable/themes/smoothness/jquery-ui-1.8.4.custom.css&quot;;
	body{ font-size:12px;}
	table{ font-size:12px;}
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;./style/datatable/js/jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;./style/datatable/js/jquery.dataTables.min.js&quot;&gt;&lt;/script&gt;
&nbsp;
&lt;script type=&quot;text/javascript&quot;&gt;
	/* 构造每一行详情的函数 fnFormatDetails*/
	function fnFormatDetails ( oTable, nTr ){
		var aData = oTable.fnGetData( nTr );
		var sOut = '&lt;table cellpadding=&quot;6&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; style=&quot;padding-left:50px;&quot;&gt;'; //在这里定义要返回的内容
		sOut += '&lt;tr&gt;&lt;td&gt;Rendering engine:&lt;/td&gt;&lt;td&gt;'+aData[1]+' '+aData[4]+'&lt;/td&gt;&lt;/tr&gt;';
		sOut += '&lt;tr&gt;&lt;td&gt;Link to source:&lt;/td&gt;&lt;td&gt;Could provide a link here&lt;/td&gt;&lt;/tr&gt;';
		sOut += '&lt;tr&gt;&lt;td&gt;Extra info:&lt;/td&gt;&lt;td&gt;And any further details here (images etc)&lt;/td&gt;&lt;/tr&gt;';
		sOut += '&lt;/table&gt;';
		return sOut;
	}
&nbsp;
	/*页面元素加载完成后开始执行*/
	$(document).ready(function() {
		/*显示每一行详情用_start*/
		var nCloneTh = document.createElement( 'th' );
		var nCloneTd = document.createElement( 'td' );
		nCloneTd.innerHTML = '&lt;img src=&quot;./style/datatable/images/details_open.png&quot;&gt;';
		nCloneTd.className = &quot;center&quot;;
		$('#example thead tr').each( function () {
			this.insertBefore( nCloneTh, this.childNodes[0] );
		} );
		$('#example tbody tr').each( function () {
			this.insertBefore(  nCloneTd.cloneNode( true ), this.childNodes[0] );
		} );
		/*显示每一行详情用_end*/
&nbsp;
		var asInitVals = new Array(); //用于每一列搜索过滤
	    var oTable =$('#example').dataTable( //var oTable用于每一列搜索过滤
	    	{
				/*基本参数设置，以下参数设置和默认效果一致*/
	    		&quot;bPaginate&quot;: true, //翻页功能
	    		&quot;bLengthChange&quot;: true, //改变每页显示数据数量
	    		&quot;bFilter&quot;: true, //过滤功能
	    		&quot;bSort&quot;: true, //排序功能
	    		&quot;bInfo&quot;: true,//页脚信息
	    		&quot;bAutoWidth&quot;: true,//自动宽度
	    		/*默认排序设置*/
	    		&quot;aaSorting&quot;: [[ 4, &quot;desc&quot; ]],//设置第5个元素为默认排序
                /*默认翻页样式设置*/
	    		&quot;sPaginationType&quot;: &quot;full_numbers&quot;,
	    		/*是否开启主题*/
	    		&quot;bJQueryUI&quot;: true,
				/*语言设置*/
	            &quot;oLanguage&quot;: {
	                &quot;sLengthMenu&quot;: &quot;每页显示 _MENU_条&quot;,
	                &quot;sZeroRecords&quot;: &quot;没有找到符合条件的数据&quot;,
	                &quot;sProcessing&quot;: &quot;&lt;img src=’./loading.gif’ /&gt;&quot;,
	                &quot;sInfo&quot;: &quot;当前第 _START_ - _END_ 条　共计 _TOTAL_ 条&quot;,
	                &quot;sInfoEmpty&quot;: &quot;木有记录&quot;,
	                &quot;sInfoFiltered&quot;: &quot;(从 _MAX_ 条记录中过滤)&quot;,
	                &quot;sSearch&quot;: &quot;搜索：&quot;,
                	&quot;oPaginate&quot;: {
    	            	&quot;sFirst&quot;: &quot;首页&quot;,
    	            	&quot;sPrevious&quot;: &quot;前一页&quot;,
    	            	&quot;sNext&quot;: &quot;后一页&quot;,
    	            	&quot;sLast&quot;: &quot;尾页&quot;
    		        }
	            }
			}
	    );
&nbsp;
		/*每一列搜索过滤代码开始*/
	    $(&quot;tfoot input&quot;).keyup( function () {
	        oTable.fnFilter( this.value, $(&quot;tfoot input&quot;).index(this) );
	    } );
	    $(&quot;tfoot input&quot;).each( function (i) {
	        asInitVals[i] = this.value;
	    } );
	    $(&quot;tfoot input&quot;).focus( function () {
	        if ( this.className == &quot;search_init&quot; )
	        {
	            this.className = &quot;&quot;;
	            this.value = &quot;&quot;;
	        }
	    } );
	    $(&quot;tfoot input&quot;).blur( function (i) {
	        if ( this.value == &quot;&quot; )
	        {
	            this.className = &quot;search_init&quot;;
	            this.value = asInitVals[$(&quot;tfoot input&quot;).index(this)];
	        }
	    } );
&nbsp;
		/*加入展开，收缩每一行详情按钮用*/
		$('#example tbody td img').live('click', function () {
			var nTr = $(this).parents('tr')[0];
			if ( oTable.fnIsOpen(nTr) )
			{
				this.src = &quot;./style/datatable/images/details_open.png&quot;;
				oTable.fnClose( nTr );
			}
			else
			{
				this.src = &quot;./style/datatable/images/details_close.png&quot;;
				oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
			}
		} );
	} );
&lt;/script&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&lt;div style=&quot; width:800px; margin:0 auto;&quot;&gt;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;display&quot; border=&quot;0&quot; id=&quot;example&quot;&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;ID&lt;/th&gt;
    &lt;th&gt;时间&lt;/th&gt;
    &lt;th&gt;数量&lt;/th&gt;
    &lt;th&gt;次数&lt;/th&gt;
    &lt;th&gt;消耗&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rows</span><span style="color: #339933;">=</span><span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$rows</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y-m-d H:i:s&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$rows</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;
	&lt;tr&gt;
	  &lt;td&gt;<span style="color: #006699; font-weight: bold;">{$rows['ID']}</span>&lt;/td&gt;
	  &lt;td&gt;<span style="color: #006699; font-weight: bold;">{$rows['time']}</span>&lt;/td&gt;
	  &lt;td&gt;<span style="color: #006699; font-weight: bold;">{$rows['r_num']}</span>&lt;/td&gt;
	  &lt;td&gt;<span style="color: #006699; font-weight: bold;">{$rows['r_times']}</span>&lt;/td&gt;
	  &lt;td&gt;<span style="color: #006699; font-weight: bold;">{$rows['money']}</span>&lt;/td&gt;
	&lt;/tr&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/tbody&gt;
&lt;tfoot&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;/th&gt;
    &lt;th&gt;ID&lt;/th&gt;
    &lt;th&gt;时间&lt;/th&gt;
    &lt;th&gt;数量&lt;/th&gt;
    &lt;th&gt;次数&lt;/th&gt;
    &lt;th&gt;消耗&lt;/th&gt;
  &lt;/tr&gt;
	&lt;tr&gt;
		&lt;th&gt;&lt;/th&gt;
		&lt;th&gt;&lt;input type=&quot;text&quot; name=&quot;search_engine&quot; value=&quot;Search engines&quot; class=&quot;search_init&quot; /&gt;&lt;/th&gt;
		&lt;th&gt;&lt;input type=&quot;text&quot; name=&quot;search_browser&quot; value=&quot;Search browsers&quot; class=&quot;search_init&quot; /&gt;&lt;/th&gt;
		&lt;th&gt;&lt;input type=&quot;text&quot; name=&quot;search_platform&quot; value=&quot;Search platforms&quot; class=&quot;search_init&quot; /&gt;&lt;/th&gt;
		&lt;th&gt;&lt;input type=&quot;text&quot; name=&quot;search_version&quot; value=&quot;Search versions&quot; class=&quot;search_init&quot; /&gt;&lt;/th&gt;
		&lt;th&gt;&lt;input type=&quot;text&quot; name=&quot;search_grade&quot; value=&quot;Search grades&quot; class=&quot;search_init&quot; /&gt;&lt;/th&gt;
	&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;/table&gt;
&lt;style&gt;
#example tr.even:hover {background-color: #ECFFB3;}
#example tr.even:hover td.sorting_1 {background-color: #DDFF75;}
#example tr.even:hover td.sorting_2 {background-color: #E7FF9E;}
#example tr.even:hove3 {background-color: #E2FF89;}
#example tr.odd:hover {background-color: #E6FF99;}
#example tr.odd:hover td.sorting_1 {background-color: #D6FF5C;}
#example tr.odd:hover td.sorting_2 {background-color: #E0FF84;}
#example tr.odd:hover td.sorting_3 {background-color: #DBFF70;}
&lt;/style&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>实现了上面绝大部分功能！以上php+datatables示例仅适用于数据量少时的情况，数据量大的情况<a href="http://www.coolwinds.cn" title="寒风网" target="_blank">寒风</a>以后再专门写博文~<br />
最终效果图如下：<br />
<a href="http://www.coolwinds.cn/wp-content/uploads/2012/02/简单示例效果图.jpg" class="highslide-image" onclick="return hs.expand(this);"><img src="http://www.coolwinds.cn/wp-content/uploads/2012/02/简单示例效果图-300x181.jpg" alt="" title="简单示例效果图" width="300" height="181" class="alignnone size-medium wp-image-1402" /></a></p>
<ul class="related_post"><li><a href="http://www.coolwinds.cn/article/design/1412.htm" title="datatables之ajax的应用">datatables之ajax的应用</a></li><li><a href="http://www.coolwinds.cn/article/design/1421.htm" title="datatables高级应用之服务端处理数据">datatables高级应用之服务端处理数据</a></li><li><a href="http://www.coolwinds.cn/article/wp/1251.htm" title="代码高亮插件WP-Syntax应用与修改">代码高亮插件WP-Syntax应用与修改</a></li><li><a href="http://www.coolwinds.cn/article/wp/872.htm" title="WP插件推荐：wordpress-tencent-microblog，腾讯微博调用插件">WP插件推荐：wordpress-tencent-microblog，腾讯微博调用插件</a></li><li><a href="http://www.coolwinds.cn/article/life/804.htm" title="终于下雨了！">终于下雨了！</a></li><li><a href="http://www.coolwinds.cn/article/wp/585.htm" title="Wordpress插件推荐：Auto Highslide，超炫图片效果">Wordpress插件推荐：Auto Highslide，超炫图片效果</a></li><li><a href="http://www.coolwinds.cn/article/wp/543.htm" title="Wordpress插件推荐：Akismet，反垃圾评论利器">Wordpress插件推荐：Akismet，反垃圾评论利器</a></li><li><a href="http://www.coolwinds.cn/article/wp/488.htm" title="Wordpress插件推荐：wp-cumulus，超酷标签">Wordpress插件推荐：wp-cumulus，超酷标签</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.coolwinds.cn/article/design/1384.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>教你快速找出一听(1ting)音乐网的歌曲真实地址</title>
		<link>http://www.coolwinds.cn/article/pc/1376.htm</link>
		<comments>http://www.coolwinds.cn/article/pc/1376.htm#comments</comments>
		<pubDate>Tue, 17 Jan 2012 08:57:28 +0000</pubDate>
		<dc:creator>寒风</dc:creator>
				<category><![CDATA[电脑玩家]]></category>
		<category><![CDATA[一听]]></category>
		<category><![CDATA[歌]]></category>
		<category><![CDATA[源代码]]></category>

		<guid isPermaLink="false">http://www.coolwinds.cn/?p=1376</guid>
		<description><![CDATA[<a href="http://www.coolwinds.cn/article/pc" target="_blank"><img src="/wp-content/uploads/img/pc.gif" border="0" alt="点击进入寒风网电脑常识分类" hspace="0" align="right"></a>一听音乐网的确是个很不错的音乐网站，之前还有一听音乐电台的，貌似被河蟹掉了？

有时候在一听上听到一首好听的歌曲，想下下来才发现：

<a href="http://www.coolwinds.cn/wp-content/uploads/2012/01/00.jpg"><img class="alignnone size-medium wp-image-1377" title="提示要下载一听音乐盒才能下载" src="http://www.coolwinds.cn/wp-content/uploads/2012/01/00-300x147.jpg" alt="" width="300" height="147" /></a>

提示要下载一听音乐盒才能下载，有木有办法不下载一听音乐盒就能下载歌曲呢？<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>接下来就教你快速找出一听(1ting)音乐网的歌曲真实地址。

以chrome浏览器为例，当然神马世界之窗极速版，枫树，360极速版等以chrome为内核的浏览器都是可以的（其他带开发人员工具的浏览器也行，例如firefox），在歌曲播放页面右击选择审查元素。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.coolwinds.cn/article/pc" target="_blank"><img src="/wp-content/uploads/img/pc.gif" border="0" alt="点击进入寒风网电脑常识分类" hspace="0" align="right"></a><span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e4%b8%80%e5%90%ac" title="查看 一听 中的全部文章" target="_blank">一听</a></span>音乐网的确是个很不错的音乐网站，之前还有一听音乐电台的，貌似被河蟹掉了？</p>
<p>有时候在<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e4%b8%80%e5%90%ac" title="查看 一听 中的全部文章" target="_blank">一听</a></span>上听到一首好听的<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%ad%8c" title="查看 歌 中的全部文章" target="_blank">歌</a></span>曲，想下下来才发现：</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/01/00.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1377" title="提示要下载一听音乐盒才能下载" src="http://www.coolwinds.cn/wp-content/uploads/2012/01/00-300x147.jpg" alt="" width="300" height="147" /></a></p>
<p>提示要下载一听音乐盒才能下载，有木有办法不下载一听音乐盒就能下载<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%ad%8c" title="查看 歌 中的全部文章" target="_blank">歌</a></span>曲呢？<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>接下来就教你快速找出一听(1ting)音乐网的歌曲真实地址。</p>
<p>以chrome浏览器为例，当然神马世界之窗极速版，枫树，360极速版等以chrome为内核的浏览器都是可以的（其他带开发人员工具的浏览器也行，例如firefox），在歌曲播放页面右击选择审查元素。</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/01/0.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1378" title="审查网页元素" src="http://www.coolwinds.cn/wp-content/uploads/2012/01/0-300x188.jpg" alt="" width="300" height="188" /></a></p>
<p>看看<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%ba%90%e4%bb%a3%e7%a0%81" title="查看 源代码 中的全部文章" target="_blank">源代码</a></span>，看我们发现了神马？我们发现了一听的歌曲真实地址了：</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/01/1.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1379" title="发现一听歌曲地址" src="http://www.coolwinds.cn/wp-content/uploads/2012/01/1-300x96.jpg" alt="" width="300" height="96" /></a></p>
<p>接下来，在歌曲地址那里右击选择“Edit attribute”：</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/01/2.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1380" title="复制歌曲地址" src="http://www.coolwinds.cn/wp-content/uploads/2012/01/2-300x118.jpg" alt="" width="300" height="118" /></a></p>
<p>然后复制该地址到迅雷里面下载就可以了</p>
<p>如果你没有使用<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>上面所说的浏览器，甚至你还在使用万恶的ie6？</p>
<p>木有关系，接下来寒风教你其他方法，在播放页面右击选择查看<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%ba%90%e4%bb%a3%e7%a0%81" title="查看 源代码 中的全部文章" target="_blank">源代码</a></span>，按Ctrl+F，输入wma查找：</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2012/01/3.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1381" title="直接查看源代码" src="http://www.coolwinds.cn/wp-content/uploads/2012/01/3-300x34.jpg" alt="" width="300" height="34" /></a></p>
<blockquote><p>答疑：为什么要搜wma？</p>
<p>a. 因为通过我多年的观察，一听的歌基本都是wma的，原因其实很简单，同样音质的歌曲wma比mp3体积小。如果wma搜不到，尝试一下mp3。</p></blockquote>
<p>看到这个了么？</p>
<blockquote><p>\/zzzzzmp3\/2011lDec\/28L\/28zhangnl\/01.wma</p></blockquote>
<p>这个就是歌曲的播放地址了，加了反斜杠转义了一下，去掉就行了：</p>
<blockquote><p>/zzzzzmp3/2011lDec/28L/28zhangnl/01.wma</p></blockquote>
<p>然后在这个地址前面加入http://nonie.1ting.com:9092</p>
<blockquote><p>答疑：为什么前面要加入http://nonie.1ting.com:9092?</p>
<p>a. <a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>发现一听网的歌都是这个地址 </p></blockquote>
<p>补全后，地址就是<a href="http://nonie.1ting.com:9092/zzzzzmp3/2011lDec/28L/28zhangnl/01.wma">http://nonie.1ting.com:9092/zzzzzmp3/2011lDec/28L/28zhangnl/01.wma</a></p>
<p>然后同样，复制这个地址到迅雷里面下载就行了。</p>
<ul class="related_post"><li>暂无相关日志</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.coolwinds.cn/article/pc/1376.htm/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>小巧的mysql数据库php管理工具phpMiniAdmin 1.7.111025寒风汉化版</title>
		<link>http://www.coolwinds.cn/article/free/1367.htm</link>
		<comments>http://www.coolwinds.cn/article/free/1367.htm#comments</comments>
		<pubDate>Sat, 24 Dec 2011 15:29:49 +0000</pubDate>
		<dc:creator>寒风</dc:creator>
				<category><![CDATA[免费资源]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpMiniAdmin]]></category>
		<category><![CDATA[数据库]]></category>
		<category><![CDATA[汉化]]></category>

		<guid isPermaLink="false">http://www.coolwinds.cn/?p=1367</guid>
		<description><![CDATA[<a href="http://www.coolwinds.cn/article/free" target="_blank"><img src="/wp-content/uploads/img/free.gif" border="0" alt="点击进入寒风网免费资源分类" hspace="0" align="right"></a>今天推荐个工具，是前些天无意中发现的一个mysql管理工具，名为phpMiniAdmin，最新版本号为：1.7.111025。可惜的是只有英文版本，于是自己抽空汉化了一下。

该工具有以下特点：
<blockquote>1. 仅一个php文件，体积小，使用方便；

2. 可执行mysql语句；

3. 可进行一些简单的可视化数据库操作；

4. 具有数据库备份还原功能；

5. 可设置密码，确保网站数据安全。</blockquote>
以下是<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>汉化后的截图：
<p style="text-align: center;"><a href="http://www.coolwinds.cn/wp-content/uploads/2011/12/1.png"><img class="alignnone size-medium wp-image-1368" title="填写数据库连接信息" src="http://www.coolwinds.cn/wp-content/uploads/2011/12/1-300x155.png" alt="" width="300" height="155" /></a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.coolwinds.cn/article/free" target="_blank"><img src="/wp-content/uploads/img/free.gif" alt="点击进入寒风网免费资源分类" align="right" border="0" hspace="0" /></a>今天推荐个工具，是前些天无意中发现的一个mysql管理工具，名为phpMiniAdmin，最新版本号为：1.7.111025。可惜的是只有英文版本，于是自己抽空汉化了一下。</p>
<p>该工具有以下特点：</p>
<blockquote><p>1. 仅一个php文件，体积小，使用方便；</p>
<p>2. 可执行<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/mysql" title="查看 mysql 中的全部文章" target="_blank">mysql</a></span>语句；</p>
<p>3. 可进行一些简单的可视化<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%95%b0%e6%8d%ae%e5%ba%93" title="查看 数据库 中的全部文章" target="_blank">数据库</a></span>操作；</p>
<p>4. 具有<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%95%b0%e6%8d%ae%e5%ba%93" title="查看 数据库 中的全部文章" target="_blank">数据库</a></span>备份还原功能；</p>
<p>5. 可设置密码，确保网站数据安全。</p></blockquote>
<p>以下是<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a><span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%b1%89%e5%8c%96" title="查看 汉化 中的全部文章" target="_blank">汉化</a></span>后的截图：</p>
<p style="text-align: center;"><a href="http://www.coolwinds.cn/wp-content/uploads/2011/12/1.png" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1368" title="填写数据库连接信息" src="http://www.coolwinds.cn/wp-content/uploads/2011/12/1-300x155.png" alt="" width="300" height="155" /></a></p>
<p style="text-align: center;">填写<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%95%b0%e6%8d%ae%e5%ba%93" title="查看 数据库 中的全部文章" target="_blank">数据库</a></span>连接信息</p>
<p style="text-align: center;"><a href="http://www.coolwinds.cn/wp-content/uploads/2011/12/2.png" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1369" title="连接数据库成功后的界面" src="http://www.coolwinds.cn/wp-content/uploads/2011/12/2-300x177.png" alt="" width="300" height="177" /></a></p>
<p style="text-align: center;">连接数据库成功后的界面</p>
<p style="text-align: center;"><a href="http://www.coolwinds.cn/wp-content/uploads/2011/12/3.png" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1370" title="简单数据库可视化管理" src="http://www.coolwinds.cn/wp-content/uploads/2011/12/3-300x207.png" alt="" width="300" height="207" /></a></p>
<p style="text-align: center;">简单数据库可视化管理</p>
<p style="text-align: left;">体积小巧，功能强大，绝对是值得收藏的一个php小工具！</p>
<p style="text-align: left;">最后是下载地址：</p>
<blockquote>
<p style="text-align: left;"><a title="phpminiadmin1.7.111025汉化版下载地址" href="http://down.qiannao.com/space/file/coolwinds/-4e0a-4f20-5206-4eab/sql.rar/.page" target="_blank">下载地址1</a></p>
<p style="text-align: left;"><a title="phpminiadmin1.7.111025汉化版下载地址" href="http://115.com/file/dnog9ne1" target="_blank">备用下载地址2</a></p>
</blockquote>
<p><a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>提醒：</p>
<blockquote><p>* 压缩包内包含两个文件，一个<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/phpminiadmin" title="查看 phpMiniAdmin 中的全部文章" target="_blank">phpMiniAdmin</a></span>.php为官方原版，<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/phpminiadmin" title="查看 phpMiniAdmin 中的全部文章" target="_blank">phpMiniAdmin</a></span>CN.php为<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a><span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%b1%89%e5%8c%96" title="查看 汉化 中的全部文章" target="_blank">汉化</a></span>的版本。</p>
<p>* 设置密码请打开文件，修改第11行$ACCESS_PWD=”;填写你要的密码即可！据<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>所测，本地使用时，填写了密码会有点小错。</p></blockquote>
<ul class="related_post"><li><a href="http://www.coolwinds.cn/article/design/206.htm" title="EasyPHP3.0的数据库连接密码、账户设置及如何导出数据设置">EasyPHP3.0的数据库连接密码、账户设置及如何导出数据设置</a></li><li><a href="http://www.coolwinds.cn/article/design/205.htm" title="EasyPHP3.0下如何导入MYsql数据库">EasyPHP3.0下如何导入MYsql数据库</a></li><li><a href="http://www.coolwinds.cn/article/design/1421.htm" title="datatables高级应用之服务端处理数据">datatables高级应用之服务端处理数据</a></li><li><a href="http://www.coolwinds.cn/article/design/1331.htm" title="外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问">外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问</a></li><li><a href="http://www.coolwinds.cn/article/design/399.htm" title="免费空间megabyet.net被墙">免费空间megabyet.net被墙</a></li><li><a href="http://www.coolwinds.cn/article/design/398.htm" title="最好用的PHP相册ImageVue.v2.1.7及其汉化补丁下载">最好用的PHP相册ImageVue.v2.1.7及其汉化补丁下载</a></li><li><a href="http://www.coolwinds.cn/article/free/394.htm" title="推荐个国外的PHP空间，带mysql">推荐个国外的PHP空间，带mysql</a></li><li><a href="http://www.coolwinds.cn/article/design/196.htm" title="用Easy PHP3.0在本地轻松架设PHP服务器">用Easy PHP3.0在本地轻松架设PHP服务器</a></li><li><a href="http://www.coolwinds.cn/article/design/146.htm" title="测试网站服务器必备：ASP探针和PHP探针下载">测试网站服务器必备：ASP探针和PHP探针下载</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.coolwinds.cn/article/free/1367.htm/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>替换dedeeims的编辑器，增加dede批量图片上传功能</title>
		<link>http://www.coolwinds.cn/article/design/1360.htm</link>
		<comments>http://www.coolwinds.cn/article/design/1360.htm#comments</comments>
		<pubDate>Sat, 10 Dec 2011 14:05:33 +0000</pubDate>
		<dc:creator>寒风</dc:creator>
				<category><![CDATA[网站建设]]></category>
		<category><![CDATA[dede]]></category>
		<category><![CDATA[dedecms]]></category>
		<category><![CDATA[dedeeims]]></category>
		<category><![CDATA[批量上传]]></category>
		<category><![CDATA[织梦]]></category>
		<category><![CDATA[网站]]></category>

		<guid isPermaLink="false">http://www.coolwinds.cn/?p=1360</guid>
		<description><![CDATA[<a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>今天突然发现dedecms有个比较大的更新，主站和论坛都挂出来了，版本号为5.7sp1。其中的一个更新让我眼前一亮，那就是批量上传图片功能

可能大家知道，dede以前就有批量上传，但只有图集里面有，dedeeims里面也有，是在产品图片里面。使用的是swfupload，但没有与编辑器整合

今天下载这个v5.7sp1本地调试后发现还不错，有两个问题：
<blockquote>1. 按钮提示文字和链接的中文字都是乱码，看了一下对应文件编码，为gb2312（下载的为utf-8）。总感觉织梦每次更新都有一些没做好的细节。

2.测试了上传没问题，但批量上传突破后插入图片到编辑器和删除图片居然只支持ie系列浏览器！！！-_-&#124;&#124;&#124; 狂汗！</blockquote>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>今天<a href="http://www.coolwinds.cn" target="_blank">寒风</a>突然发现dedecms有个比较大的更新，主站和论坛都挂出来了，版本号为5.7sp1。其中的一个更新让我眼前一亮，那就是批量上传图片功能</p>
<p>可能大家知道，<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/dede" title="查看 dede 中的全部文章" target="_blank">dede</a></span>以前就有<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%89%b9%e9%87%8f%e4%b8%8a%e4%bc%a0" title="查看 批量上传 中的全部文章" target="_blank">批量上传</a></span>，但只有图集里面有，<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/dede" title="查看 dede 中的全部文章" target="_blank">dede</a></span>eims里面也有，是在产品图片里面。使用的是swfupload，但没有与编辑器整合</p>
<p>今天下载这个v5.7sp1本地调试后发现还不错，有两个问题：</p>
<blockquote><p>1. 按钮提示文字和链接的中文字都是乱码，看了一下对应文件编码，为gb2312（下载的为utf-8）。总感觉<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e7%bb%87%e6%a2%a6" title="查看 织梦 中的全部文章" target="_blank">织梦</a></span>每次更新都有一些没做好的细节。</p>
<p>2.测试了上传没问题，但<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e6%89%b9%e9%87%8f%e4%b8%8a%e4%bc%a0" title="查看 批量上传 中的全部文章" target="_blank">批量上传</a></span>突破后插入图片到编辑器和删除图片居然只支持ie系列浏览器！！！-_-||| 狂汗！</p></blockquote>
<p><strong>先搁置这两个问题，研究了一下怎么把<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e7%bb%87%e6%a2%a6" title="查看 织梦 中的全部文章" target="_blank">织梦</a></span>的这个新功能移植到<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/dede" title="查看 dede 中的全部文章" target="_blank">dede</a></span>eims，以下贴出详细方法：</strong></p>
<p>1. <span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">后台核心设置，Html编辑器选项（目前仅支持fck）：改为ckeditor；</span></p>
<p>2. 复制dede5.7sp1里面的include/ckeditor文件夹到<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/dedeeims" title="查看 dedeeims 中的全部文章" target="_blank">dedeeims</a></span>的include文件夹；</p>
<p>3. 修改include/inc/inc_fun_funAdmin.php文件， 替换函数SpGetEditor：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">function SpGetEditor($fname,$fvalue,$nheight=&quot;350&quot;,$etype=&quot;Basic&quot;,$gtype=&quot;print&quot;,$isfullpage=&quot;false&quot;,$bbcode=false)
{
    global $cfg_ckeditor_initialized;
    if(!isset($GLOBALS['cfg_html_editor']))
    {
        $GLOBALS['cfg_html_editor']='fck';
    }
    if($gtype==&quot;&quot;)
    {
        $gtype = &quot;print&quot;;
    }
    if($GLOBALS['cfg_html_editor']=='fck')
    {
        require_once(DEDEINC.'/FCKeditor/fckeditor.php');
        $fck = new FCKeditor($fname);
        $fck-&gt;BasePath        = $GLOBALS['cfg_cmspath'].'/include/FCKeditor/' ;
        $fck-&gt;Width        = '100%' ;
        $fck-&gt;Height        = $nheight ;
        $fck-&gt;ToolbarSet    = $etype ;
        $fck-&gt;Config['FullPage'] = $isfullpage;
        if($GLOBALS['cfg_fck_xhtml']=='Y')
        {
            $fck-&gt;Config['EnableXHTML'] = 'true';
            $fck-&gt;Config['EnableSourceXHTML'] = 'true';
        }
        $fck-&gt;Value = $fvalue ;
        if($gtype==&quot;print&quot;)
        {
            $fck-&gt;Create();
        }
        else
        {
            return $fck-&gt;CreateHtml();
        }
    }
    else if($GLOBALS['cfg_html_editor']=='ckeditor')
    {
        require_once(DEDEINC.'/ckeditor/ckeditor.php');
        $CKEditor = new CKEditor();
        $CKEditor-&gt;basePath = $GLOBALS['cfg_cmspath'].'/include/ckeditor/' ;
        $config = $events = array();
        $config['extraPlugins'] = 'dedepage,multipic,addon';
		if($bbcode)
		{
			$CKEditor-&gt;initialized = true;
			$config['extraPlugins'] .= ',bbcode';
			$config['fontSize_sizes'] = '30/30%;50/50%;100/100%;120/120%;150/150%;200/200%;300/300%';
			$config['disableObjectResizing'] = 'true';
			$config['smiley_path'] = $GLOBALS['cfg_cmspath'].'/images/smiley/';
			// 获取表情信息
			require_once(DEDEDATA.'/smiley.data.php');
			$jsscript = array();
			foreach($GLOBALS['cfg_smileys'] as $key=&gt;$val)
			{
				$config['smiley_images'][] = $val[0];
				$config['smiley_descriptions'][] = $val[3];
				$jsscript[] = '&quot;'.$val[3].'&quot;:&quot;'.$key.'&quot;';
			}
			$jsscript = implode(',', $jsscript);
			echo jsScript('CKEDITOR.config.ubb_smiley = {'.$jsscript.'}');
		}
&nbsp;
        $GLOBALS['tools'] = empty($toolbar[$etype])? $GLOBALS['tools'] : $toolbar[$etype] ;
        $config['toolbar'] = $GLOBALS['tools'];
        $config['height'] = $nheight;
        $config['skin'] = 'kama';
        $CKEditor-&gt;returnOutput = TRUE;
        $code = $CKEditor-&gt;editor($fname, $fvalue, $config, $events);
        if($gtype==&quot;print&quot;)
        {
            echo $code;
        }
        else
        {
            return $code;
        }
    }
    else { 
        /*
        // ------------------------------------------------------------------------
        // 当前版本,暂时取消dedehtml编辑器的支持
        // ------------------------------------------------------------------------
        require_once(DEDEINC.'/htmledit/dede_editor.php');
        $ded = new DedeEditor($fname);
        $ded-&gt;BasePath        = $GLOBALS['cfg_cmspath'].'/include/htmledit/' ;
        $ded-&gt;Width        = '100%' ;
        $ded-&gt;Height        = $nheight ;
        $ded-&gt;ToolbarSet = strtolower($etype);
        $ded-&gt;Value = $fvalue ;
        if($gtype==&quot;print&quot;)
        {
            $ded-&gt;Create();
        }
        else
        {
            return $ded-&gt;CreateHtml();
        }
        */
    }
}</pre></td></tr></table></div>

<p>4. 后台dede/templets/article_add,article_edit模版文件，加入：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;style type=&quot;text/css&quot;&gt;
&lt;!--
body { background-image: url(images/allbg.gif); }
.multipic {
	border: 1px dashed #FC6;
}
.albCt {
	border-bottom: 1px dashed #FC0;
	margin-bottom: 10px;
	padding-bottom:10px;
}
.albCt img{
	cursor:pointer;
}
--&gt;
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;../images/swfupload/swfupload.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;src=&quot;js/handlers.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/calendar/calendar.js&quot;&gt;&lt;/script&gt;</pre></td></tr></table></div>

<p>5. 后台dede/templets/article_add,article_edit里面的js改成：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;script language=&quot;javascript&quot;&gt;
&lt;!--
var swfu = null;
var arctype = 'article';
function checkSubmit()
{
	if(document.form1.title.value==&quot;&quot;){
		alert(&quot;文章标题不能为空！&quot;);
		return false;
	}
	if(document.form1.typeid.value==0){//article_edit.htm可以不加这个判断
		alert(&quot;请选择档案的主类别！&quot;);
		return false;
	}
}
window.onload = function ()
{
	swfu = new SWFUpload(
	{
		// Backend Settings
		upload_url: &quot;swfupload.php&quot;,
		post_params: {&quot;PHPSESSID&quot;: &quot;&lt;?php echo session_id(); ?&gt;&quot;, &quot;dopost&quot; : &quot;&quot;, &quot;arctype&quot; : arctype},
&nbsp;
		// File Upload Settings
		file_size_limit : &quot;2 MB&quot;,	// 2MB
		file_types : &quot;*.jpg; *.gif; *.png&quot;,
		file_types_description : &quot;选择 JPEG/GIF/PNG 格式图片&quot;,
		file_upload_limit : &quot;0&quot;,
&nbsp;
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,
&nbsp;
		button_image_url : &quot;../images/SmallSpyGlassWithTransperancy_17x18.png&quot;,
		button_placeholder_id : &quot;spanButtonPlaceholder&quot;,
		button_width: '100%',
		button_height: 26,
		button_text : '&lt;div class=&quot;button&quot; style=&quot;background-color:#E5F1CF; height:26px; text-align:center; line-height:26px&quot;&gt;上传图片(可多选)&lt;/div&gt;',
		button_text_style : '',
		button_text_top_padding: 0,
		button_text_left_padding: 10,
		button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
		button_cursor: SWFUpload.CURSOR.HAND,
&nbsp;
		// Flash Settings
		flash_url : &quot;../images/swfupload/swfupload.swf&quot;,
&nbsp;
		custom_settings : {
			upload_target : &quot;divFileProgressContainer&quot;
		},
&nbsp;
		// Debug Settings
		debug: false
	});
};
&nbsp;
function addtoEdit(pid)
{
	jQuery.get('swfupload.php?dopost=addtoedit&amp;id=' + pid, function(data)
	{
		var picTitle = jQuery('input[name=&quot;picinfook'+pid+'&quot;]').val();
		var picHTML = '&lt;img src=&quot;'+data+'&quot; alt=&quot;'+picTitle+'&quot;/&gt;';
		CKEDITOR.instances.body.insertHtml(picHTML);
	});
}
&nbsp;
//删除已经上传的图片
function delAlbPic(pid){
	// 同步删除编辑器中插入的图片
	jQuery(&quot;#__tmpbody&quot;).html();
	jQuery.get('swfupload.php?dopost=addtoedit&amp;id=' + pid, function(data)
	{
		var iptbody = CKEDITOR.instances.body.getData();
		jQuery(&quot;#__tmpbody&quot;).html(iptbody);
		jQuery(&quot;#__tmpbody&quot;).find('img').each(function()
		{
			if(jQuery(this).attr('src') == data)
			{
				//alert(data);
				jQuery(this).remove();
			}
		});
		CKEDITOR.instances.body.setData(jQuery(&quot;#__tmpbody&quot;).html()); 
		jQuery(&quot;#__tmpbody&quot;).html();
		var tgobj = $Obj('albCtok'+pid);
		var myajax = new DedeAjax(tgobj);
		myajax.SendGet2('swfupload.php?dopost=del&amp;id='+pid);
		$Obj('thumbnails').removeChild(tgobj);
	});
}
&nbsp;
//删除已经上传的图片(编辑时用)
function delAlbPicOld(picfile, pid){
	var tgobj = $Obj('albold'+pid);
	var myajax = new DedeAjax(tgobj);
	myajax.SendGet2('swfupload.php?dopost=delold&amp;picfile='+picfile);
	$Obj('thumbnailsEdit').removeChild(tgobj);
}
--&gt;
&lt;/script&gt;</pre></td></tr></table></div>

<p>6. 后台dede/templets/article_add.htm,article_edit.htm,编辑器调用
<td>格右边加入:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">      &lt;td width=&quot;255&quot; align=&quot;center&quot; valign=&quot;top&quot; bgcolor=&quot;#FFFFCC&quot; id=&quot;mPic&quot; style=&quot;display:none&quot;&gt;&lt;div class=&quot;multipic&quot;&gt;
      &lt;div style=&quot;display: block;background-color:#E5F1CF; height:26px&quot;&gt;
								&lt;span id=&quot;spanButtonPlaceholder&quot;&gt;&lt;/span&gt;
	  &lt;/div&gt;
      &lt;div id=&quot;divFileProgressContainer&quot;&gt;&lt;/div&gt;
      &lt;div id=&quot;thumbnails&quot; style=&quot;width: 254px; height: 535px; background-color: rgb(255, 255, 255); overflow-y: scroll;&quot;&gt;&lt;/div&gt;
      &lt;/div&gt;&lt;/td&gt;</pre></td></tr></table></div>

<p>7. 拷贝v5.7sp1的dede/js/calendar文件夹到<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/dedeeims" title="查看 dedeeims 中的全部文章" target="_blank">dedeeims</a></span>的dede/js/</p>
<p>8. 替换<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/dedeeims" title="查看 dedeeims 中的全部文章" target="_blank">dedeeims</a></span>的dede/swfupload.php为v5.7sp1的</p>
<p>9. 替换dedeeims的include/dialog文件夹为v5.7sp1的</p>
<p>步骤很麻烦，修改比较多，但绝对有效果的，<a href="http://www.coolwinds.cn" target="_blank">寒风</a>还做了个安装版的，具体效果图这台电脑上木有，下次修改文章补上，顺便把所有修改了的文件打包发上来，嘿嘿~</p>
<p>兼容bug已经反馈到织梦论坛，现在<a href="http://www.coolwinds.cn" target="_blank">寒风</a>坐等织梦更新，再跟进</p>
<ul class="related_post"><li><a href="http://www.coolwinds.cn/article/design/1314.htm" title="教你在首页调用ecshop指定分类下的商品">教你在首页调用ecshop指定分类下的商品</a></li><li><a href="http://www.coolwinds.cn/article/design/1353.htm" title="今天的成果，php邮件订阅功能">今天的成果，php邮件订阅功能</a></li><li><a href="http://www.coolwinds.cn/article/life/1347.htm" title="Hey men, this is my website! Go away!">Hey men, this is my website! Go away!</a></li><li><a href="http://www.coolwinds.cn/article/design/1331.htm" title="外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问">外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问</a></li><li><a href="http://www.coolwinds.cn/article/life/1324.htm" title="更换服务器，网站终于OK了">更换服务器，网站终于OK了</a></li><li><a href="http://www.coolwinds.cn/article/design/1322.htm" title="教你如何在dedecms模板里面加判断">教你如何在dedecms模板里面加判断</a></li><li><a href="http://www.coolwinds.cn/article/life/1304.htm" title="网站PR终于更新了！">网站PR终于更新了！</a></li><li><a href="http://www.coolwinds.cn/article/design/1299.htm" title="修改dedecms标题长度及修复上传图集不加水印的bug">修改dedecms标题长度及修复上传图集不加水印的bug</a></li><li><a href="http://www.coolwinds.cn/article/design/1267.htm" title="换主题啦！">换主题啦！</a></li><li><a href="http://www.coolwinds.cn/article/design/1224.htm" title="让dedecms的信息发布员组和频道管理员组能查看和修改商店订单记录">让dedecms的信息发布员组和频道管理员组能查看和修改商店订单记录</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.coolwinds.cn/article/design/1360.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>今天的成果，php邮件订阅功能</title>
		<link>http://www.coolwinds.cn/article/design/1353.htm</link>
		<comments>http://www.coolwinds.cn/article/design/1353.htm#comments</comments>
		<pubDate>Fri, 09 Dec 2011 10:33:48 +0000</pubDate>
		<dc:creator>寒风</dc:creator>
				<category><![CDATA[网站建设]]></category>
		<category><![CDATA[网站]]></category>
		<category><![CDATA[邮件]]></category>
		<category><![CDATA[邮件订阅]]></category>

		<guid isPermaLink="false">http://www.coolwinds.cn/?p=1353</guid>
		<description><![CDATA[<a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>每天对着电脑，头晕脑胀！

贴一下今天的成果，虽然是个很简单的东西，但自己写出来还是很有成就感的说，嘿嘿~

主要实现的是邮件订阅功能，用户可以在前台输入email加入订阅名单，或者取消订阅

后台则是通过手动发送邮件来发送订阅信息，支持邮件群发！

首先是前台：

<a href="http://www.coolwinds.cn/wp-content/uploads/2011/12/php邮件订阅前台.jpg"><img class="alignnone size-full wp-image-1354" title="php邮件订阅前台" src="http://www.coolwinds.cn/wp-content/uploads/2011/12/php邮件订阅前台.jpg" alt="" width="188" height="113" /></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>每天对着电脑，头晕脑胀！</p>
<p>贴一下今天的成果，虽然是个很简单的东西，但自己写出来还是很有成就感的说，嘿嘿~</p>
<p>主要实现的是<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e9%82%ae%e4%bb%b6" title="查看 邮件 中的全部文章" target="_blank">邮件</a></span>订阅功能，用户可以在前台输入email加入订阅名单，或者取消订阅</p>
<p>后台则是通过手动发送<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e9%82%ae%e4%bb%b6" title="查看 邮件 中的全部文章" target="_blank">邮件</a></span>来发送订阅信息，支持邮件群发！</p>
<p>首先是前台：</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2011/12/php邮件订阅前台.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-1354" title="php邮件订阅前台" src="http://www.coolwinds.cn/wp-content/uploads/2011/12/php邮件订阅前台.jpg" alt="" width="188" height="113" /></a></p>
<p>前台页面未做任何美化，今天主要实现功能而已！</p>
<p>后台：</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2011/12/php邮件订阅后台.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1355" title="php邮件订阅后台" src="http://www.coolwinds.cn/wp-content/uploads/2011/12/php邮件订阅后台-300x204.jpg" alt="" width="300" height="204" /></a></p>
<p>我的一贯风格！嘿嘿，和那个<a title="ip屏蔽" href="http://www.coolwinds.cn/article/design/1331.htm">ip屏蔽</a>后台样式一样！简洁就好！</p>
<p>当然后续还可以加入更多功能，可以慢慢完善，这个也可以当作一个纯粹的邮件群发工具。</p>
<p>这次代码就先不贴出来了</p>
<p>结个尾，准备挤公交去了~</p>
<ul class="related_post"><li><a href="http://www.coolwinds.cn/article/design/1360.htm" title="替换dedeeims的编辑器，增加dede批量图片上传功能">替换dedeeims的编辑器，增加dede批量图片上传功能</a></li><li><a href="http://www.coolwinds.cn/article/life/1347.htm" title="Hey men, this is my website! Go away!">Hey men, this is my website! Go away!</a></li><li><a href="http://www.coolwinds.cn/article/design/1331.htm" title="外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问">外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问</a></li><li><a href="http://www.coolwinds.cn/article/life/1324.htm" title="更换服务器，网站终于OK了">更换服务器，网站终于OK了</a></li><li><a href="http://www.coolwinds.cn/article/design/1314.htm" title="教你在首页调用ecshop指定分类下的商品">教你在首页调用ecshop指定分类下的商品</a></li><li><a href="http://www.coolwinds.cn/article/life/1304.htm" title="网站PR终于更新了！">网站PR终于更新了！</a></li><li><a href="http://www.coolwinds.cn/article/design/1267.htm" title="换主题啦！">换主题啦！</a></li><li><a href="http://www.coolwinds.cn/article/design/879.htm" title="今天为网站彻底更换了一个色调">今天为网站彻底更换了一个色调</a></li><li><a href="http://www.coolwinds.cn/article/design/837.htm" title="小博今天的IP有望突破1000大关！">小博今天的IP有望突破1000大关！</a></li><li><a href="http://www.coolwinds.cn/article/life/791.htm" title="好久没上网了~~~~~~~~怀念ing">好久没上网了~~~~~~~~怀念ing</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.coolwinds.cn/article/design/1353.htm/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Hey men, this is my website! Go away!</title>
		<link>http://www.coolwinds.cn/article/life/1347.htm</link>
		<comments>http://www.coolwinds.cn/article/life/1347.htm#comments</comments>
		<pubDate>Tue, 22 Nov 2011 04:43:56 +0000</pubDate>
		<dc:creator>寒风</dc:creator>
				<category><![CDATA[我的生活]]></category>
		<category><![CDATA[网站]]></category>

		<guid isPermaLink="false">http://www.coolwinds.cn/?p=1347</guid>
		<description><![CDATA[<a href="http://www.coolwinds.cn/article/life" target="_blank"><img src="/wp-content/uploads/img/life.gif" alt="点击进入我的生活分类！" align="right" border="0" hspace="0" /></a>由于实在太忙，都没时间去更新网站了！

前几天打开网站一看，一篇文章都没了，貌似被删了，当时傻眼了，好久没备份了。

打开后台看了一下，文章全没了，评论还在。

还好后来联系了老薛客服，帮忙恢复了数据。

今天才有空来处理一下这个问题。

当初第一反应就是，该不会是别人盗了我的密码恶意删除吧？

ok

<a href="http://www.coolwinds.cn/wp-content/uploads/2011/11/未命名.jpg"><img class="alignnone size-medium wp-image-1348" title="heymen" src="http://www.coolwinds.cn/wp-content/uploads/2011/11/未命名-300x43.jpg" alt="" width="300" height="43" /></a>

hey men, this is my website! Go away!]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.coolwinds.cn/article/life" target="_blank"><img src="/wp-content/uploads/img/life.gif" alt="点击进入我的生活分类！" align="right" border="0" hspace="0" /></a>由于实在太忙，都没时间去更新网站了！</p>
<p>前几天打开<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e7%bd%91%e7%ab%99" title="查看 网站 中的全部文章" target="_blank">网站</a></span>一看，一篇文章都没了，貌似被删了，当时傻眼了，好久没备份了。</p>
<p>打开后台看了一下，文章全没了，评论还在。</p>
<p>还好后来联系了老薛客服，帮忙恢复了数据。</p>
<p>今天才有空来处理一下这个问题。</p>
<p>当初第一反应就是，该不会是别人盗了我的密码恶意删除吧？</p>
<p>ok</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2011/11/未命名.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1348" title="heymen" src="http://www.coolwinds.cn/wp-content/uploads/2011/11/未命名-300x43.jpg" alt="" width="300" height="43" /></a></p>
<p>hey men, this is my website! Go away!</p>
<ul class="related_post"><li><a href="http://www.coolwinds.cn/article/design/1360.htm" title="替换dedeeims的编辑器，增加dede批量图片上传功能">替换dedeeims的编辑器，增加dede批量图片上传功能</a></li><li><a href="http://www.coolwinds.cn/article/design/1353.htm" title="今天的成果，php邮件订阅功能">今天的成果，php邮件订阅功能</a></li><li><a href="http://www.coolwinds.cn/article/design/1331.htm" title="外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问">外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问</a></li><li><a href="http://www.coolwinds.cn/article/life/1324.htm" title="更换服务器，网站终于OK了">更换服务器，网站终于OK了</a></li><li><a href="http://www.coolwinds.cn/article/design/1314.htm" title="教你在首页调用ecshop指定分类下的商品">教你在首页调用ecshop指定分类下的商品</a></li><li><a href="http://www.coolwinds.cn/article/life/1304.htm" title="网站PR终于更新了！">网站PR终于更新了！</a></li><li><a href="http://www.coolwinds.cn/article/design/1267.htm" title="换主题啦！">换主题啦！</a></li><li><a href="http://www.coolwinds.cn/article/design/879.htm" title="今天为网站彻底更换了一个色调">今天为网站彻底更换了一个色调</a></li><li><a href="http://www.coolwinds.cn/article/design/837.htm" title="小博今天的IP有望突破1000大关！">小博今天的IP有望突破1000大关！</a></li><li><a href="http://www.coolwinds.cn/article/life/791.htm" title="好久没上网了~~~~~~~~怀念ing">好久没上网了~~~~~~~~怀念ing</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.coolwinds.cn/article/life/1347.htm/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问</title>
		<link>http://www.coolwinds.cn/article/design/1331.htm</link>
		<comments>http://www.coolwinds.cn/article/design/1331.htm#comments</comments>
		<pubDate>Sun, 25 Sep 2011 15:06:48 +0000</pubDate>
		<dc:creator>寒风</dc:creator>
				<category><![CDATA[网站建设]]></category>
		<category><![CDATA[ecshop]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[网站]]></category>

		<guid isPermaLink="false">http://www.coolwinds.cn/?p=1331</guid>
		<description><![CDATA[<a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>前几天做外贸站的时候遇到个问题，就是如何限制IP地址段访问，ecshop默认是没有这个功能的，到网上搜了一下，凑了一些代码，自己再加工，添加了一些代码，有了以下成品，先看效果：

后台界面如下：

<a href="http://www.coolwinds.cn/wp-content/uploads/2011/09/phpIP屏蔽后台效果图.png"><img class="alignnone size-medium wp-image-1332" title="phpIP屏蔽后台效果图，for ecshop。by coolwinds.cn" src="http://www.coolwinds.cn/wp-content/uploads/2011/09/phpIP屏蔽后台效果图-300x185.png" alt="" width="300" height="185" /></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.coolwinds.cn/article/design" target="_blank"><img src="/wp-content/uploads/img/www.gif" border="0" alt="点击进入寒风网网站建设分类" hspace="0" align="right"></a>前几天做外贸站的时候遇到个问题，就是如何限制IP地址段访问，ecshop默认是没有这个功能的，到网上搜了一下，凑了一些代码，自己再加工，添加了一些代码，有了以下成品，先看效果：</p>
<blockquote><p><em>20110928修复可耻的IE6兼容问题</em></p></blockquote>
<p>后台界面如下：</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2011/09/phpIP屏蔽后台效果图.png" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1332" title="phpIP屏蔽后台效果图，for ecshop。by coolwinds.cn" src="http://www.coolwinds.cn/wp-content/uploads/2011/09/phpIP屏蔽后台效果图-300x185.png" alt="" width="300" height="185" /></a></p>
<p>设定屏蔽<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/ip" title="查看 IP 中的全部文章" target="_blank">IP</a></span>段后，前台效果如下：</p>
<p><a href="http://www.coolwinds.cn/wp-content/uploads/2011/09/phpIP屏蔽前台效果.png" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-medium wp-image-1333" title="phpIP屏蔽前台效果，for ecshop。by coolwinds.cn" src="http://www.coolwinds.cn/wp-content/uploads/2011/09/phpIP屏蔽前台效果-300x124.png" alt="" width="300" height="124" /></a></p>
<p>接下来，<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>讲讲具体实现方法(安全起见，仅屏蔽前台，屏蔽<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/ip" title="查看 IP 中的全部文章" target="_blank">IP</a></span>段地址可在后台设置！)：</p>
<p><strong>前台</strong><strong></strong></p>
<p><strong>1.  includes文件夹下新建ip.php文件，内容为：</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;?php
/*///////////////////////////////////
//屏蔽IP地址段 V0.1                 
//时间：2011.09.24 15：40           
//代码：http://www.hisune.com      
*/////////////////////////////////////
class IP{                       //获取客户IP地址 
function getIpAdr(&amp;$ip){
$ip = ($_SERVER[&quot;HTTP_VIA&quot;]) ? $_SERVER[&quot;HTTP_X_FORWARDED_FOR&quot;] : $_SERVER[&quot;REMOTE_ADDR&quot;];
$ip = ($ip) ? $ip : $_SERVER[&quot;REMOTE_ADDR&quot;];   
}
}
function get_netip($myip){   //只留客户IP地址的前三位 
  $temp=explode(&quot;.&quot;,$myip);
  $netip.=$temp[0];
  $netip.=&quot;.&quot;;
  $netip.=$temp[1];
  $netip.=&quot;.&quot;;
  $netip.=$temp[2];
  return $netip;
}
$filename=&quot;includes\ip.txt&quot;;     //定义操作文件
$ip_lib=file($filename);  //读取文件数据到数组中
$allow=0;
$IP=new IP;
$thisip=&quot;&quot;;
$IP-&gt;getIpAdr($thisip);
$thenetip=get_netip($thisip);
&nbsp;
for($i=0;$i&lt;count($ip_lib);$i++){  
  if(ereg($thenetip,$ip_lib[$i])){
    $allow=1;
    break;
  }
}  
&nbsp;
if ($allow==1) 
{
  echo &quot;&lt;script&gt;location.href='error.php';&lt;/script&gt;&quot;;
}
//else {
//  echo &quot;&quot;;
//} 
/*///////////////////////////////////
//屏蔽IP地址段 V0.1                 
//时间：2011.09.24 15：40           
//代码：http://www.hisune.com      
*/////////////////////////////////////
?&gt;</pre></td></tr></table></div>

<p><strong>2.  includes文件夹下新建ip.txt空白文本文档</strong></p>
<p><strong>3.  根目录下新建error.php，内容为：</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot; /&gt;
&lt;title&gt;错误，您的IP不在本站的服务范围之内。&lt;/title&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&nbsp;
&lt;div style=&quot; margin:80px 200px; border: solid 1px #C0C0C0;&quot;&gt;
  &lt;div style=&quot; border: solid 3px #EAEAEA; padding:30px; text-align:center&quot;&gt;
    &lt;img src=&quot;themes/bk/images/warning.gif&quot; /&gt;&amp;nbsp;抱歉，您的IP地址不在本站的服务范围之内！请联系<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e7%bd%91%e7%ab%99" title="查看 网站 中的全部文章" target="_blank">网站</a></span>管理员。&lt;br /&gt;
    Sorry, your IP address is not within the scope of the services this site! Please contact the webmaster.
  &lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p><strong>4 . 在includes文件夹下init.php文件末端插入：</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">require(ROOT_PATH . 'includes/ip.php');</pre></td></tr></table></div>

<p><strong>后台</strong><strong></strong></p>
<p><strong>5.  admin文件夹下新建ip.php文件，内容为：</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;?php
&nbsp;
/**
 * IP地址段屏蔽后台程序
 * ============================================================================
 * 版权所有 2011-2012 海尚网络，并保留所有权利。
 * <span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e7%bd%91%e7%ab%99" title="查看 网站 中的全部文章" target="_blank">网站</a></span>地址: http://www.hisune.com；
 * ----------------------------------------------------------------------------
 *文件版本：0.1
 *编写时间：2011-09-22 13:55:12
 *作者：寒风
 *个人网站：http://www.coolwinds.cn
 *专业建站：http://www.hisune.com
 * ============================================================================
**/
//read
$fp = fopen(&quot;../includes/ip.txt&quot;, 'r');
flock($fp, LOCK_SH);
$content = fread($fp, filesize(&quot;../includes/ip.txt&quot;));
flock($fp, LOCK_UN);
fclose($fp);
//display
echo &quot;&lt;div style=\&quot; border:solid 1px #D6D6D6; background:#EAEAEA; margin-left:15px; margin-right:15px;height:35px; line-height:35px; font-weight:bold; font-size:14px; text-align:center;\&quot;&gt;IP段屏蔽设置&lt;/div&gt;&quot;;
&nbsp;
echo &quot;&lt;div style=\&quot; border-left:solid 1px #D6D6D6;border-right:solid 1px #D6D6D6;border-bottom:solid 1px #D6D6D6; overflow:auto; zoom:1; padding-top:10px;  margin-left:15px; margin-right:15px;\&quot;&gt;&quot;;
echo &quot;&lt;div style=\&quot;float:left; margin-left:10px; _margin-left:5px; \&quot;&gt;&quot;;
echo &quot;&lt;form method=\&quot;post\&quot; action=\&quot;ip.php\&quot;&gt;&quot;;
echo &quot;&lt;textarea name=\&quot;ipkill\&quot; style=\&quot; height:200px; width250px; font-size:12px;\&quot; name=\&quot;ipkill\&quot; id=\&quot;ipkill\&quot;&gt;$content&lt;/textarea&gt;&quot;;
echo &quot;&lt;br /&gt;&quot;;
echo &quot;&lt;br /&gt;&quot;;
echo &quot;&lt;input  type=\&quot;submit\&quot; name=\&quot;submit\&quot; value=\&quot;保存\&quot; style=\&quot; cursor:pointer;\&quot;&gt;&amp;nbsp;&amp;nbsp;&quot;;
echo &quot;&lt;input  type=\&quot;reset\&quot; name=\&quot;reset\&quot; value=\&quot;重置\&quot; style=\&quot; cursor:pointer;\&quot;&gt;&quot;;
echo &quot;&lt;/form&gt;&quot;;
echo &quot;&lt;/div&gt;&quot;;
&nbsp;
echo &quot;&lt;div style=\&quot;float:right; font-size:12px; margin-right:10px;_margin-right:5px; border:dashed 1px #D6D6D6; padding:5px; \&quot;&gt;&quot;;
echo &quot;&lt;div style=\&quot;width:98%; padding:3px; background:#EBEBEB;\&quot;&gt;1. 在左侧输入要屏蔽的IP地址段&lt;/div&gt;&quot;;
echo &quot;&lt;br /&gt;&quot;;
echo &quot;&lt;div style=\&quot;width:98%; padding:3px; background:#EBEBEB;\&quot;&gt;2. IP地址段为前三位，每一行一个IP段如：&lt;/div&gt;&quot;;
echo &quot;192.168.1&quot;;
echo &quot;&lt;br /&gt;&quot;;
echo &quot;192.168.0&quot;;
echo &quot;&lt;br /&gt;&quot;;
echo &quot;&lt;br /&gt;&quot;;
echo &quot;&lt;div style=\&quot;width:98%; padding:3px; background:#EBEBEB;\&quot;&gt;3. 您当前登录的IP地址为：&lt;/div&gt;&quot;;
echo &quot;&lt;font color=\&quot;#ff0000;\&quot;&gt;&quot;.$ip=$_SERVER[&quot;REMOTE_ADDR&quot;].&quot;&lt;/font&gt;&quot;;
echo &quot;&lt;br /&gt;&quot;;
echo &quot;&lt;/div&gt;&quot;;
&nbsp;
echo &quot;&lt;/div&gt;&quot;;
//write
if($_POST['submit']){
$ft = fopen(&quot;../includes/ip.txt&quot;,&quot;w+&quot;); 
fwrite($ft,&quot;$_POST[ipkill]&quot;);
fclose($ft);
echo &quot;&lt;script language=\&quot;javascript\&quot;&gt;alert('保存成功！');history.go(-1)&lt;/script&gt;&quot;;
}
/**
 * IP地址段屏蔽后台程序
 * ============================================================================
 * 版权所有 2011-2012 海尚网络，并保留所有权利。
 * 网站地址: http://www.hisune.com；
 * ----------------------------------------------------------------------------
 *文件版本：0.1
 *编写时间：2011-09-22 13:55:12
 *作者：寒风
 *个人网站：http://www.coolwinds.cn
 *专业建站：http://www.hisune.com
 * ============================================================================
**/
?&gt;</pre></td></tr></table></div>

<p><strong>6.  admin/templates/top.htm文件：</strong></p>
<p>搜索：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;li&gt;&lt;a href=&quot;{$key}&quot; target=&quot;main-frame&quot;&gt;{$item}&lt;/a&gt;&lt;/li&gt;</pre></td></tr></table></div>

<p>在其后加入：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;li&gt;&lt;a href=&quot;javascript:window.open('ip.php','_blank','width=620,height=350');void(0)&quot;&gt;IP段屏蔽&lt;/a&gt;&lt;/li&gt;</pre></td></tr></table></div>

<p>这样就可以在<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/ecshop" title="查看 ecshop 中的全部文章" target="_blank">ecshop</a></span>后台导航条处看到链接了</p>
<p>所有代码如上，<a title="寒风网" href="http://www.coolwinds.cn" target="_blank">寒风</a>自己已经测试成功了。</p>
<blockquote><p>error.php文件用到的图片：<a href="http://www.coolwinds.cn/wp-content/uploads/2011/09/image005.gif" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-1334" title="错误图片" src="http://www.coolwinds.cn/wp-content/uploads/2011/09/image005.gif" alt="" width="20" height="18" /></a></p></blockquote>
<p>当然，以上方法不仅限于添加到<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/ecshop" title="查看 ecshop 中的全部文章" target="_blank">ecshop</a></span>，添加到任意php站点都是可以的！<a href="http://www.coolwinds.cn" target="_blank">寒风</a>所写的以上内容只是以<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/ecshop" title="查看 ecshop 中的全部文章" target="_blank">ecshop</a></span>为例！</p>
<p>最后，再次AD一下，我的新站正在准备中，嘿嘿~</p>
<ul class="related_post"><li><a href="http://www.coolwinds.cn/article/design/837.htm" title="小博今天的IP有望突破1000大关！">小博今天的IP有望突破1000大关！</a></li><li><a href="http://www.coolwinds.cn/article/design/146.htm" title="测试网站服务器必备：ASP探针和PHP探针下载">测试网站服务器必备：ASP探针和PHP探针下载</a></li><li><a href="http://www.coolwinds.cn/article/free/1367.htm" title="小巧的mysql数据库php管理工具phpMiniAdmin 1.7.111025寒风汉化版">小巧的mysql数据库php管理工具phpMiniAdmin 1.7.111025寒风汉化版</a></li><li><a href="http://www.coolwinds.cn/article/design/1360.htm" title="替换dedeeims的编辑器，增加dede批量图片上传功能">替换dedeeims的编辑器，增加dede批量图片上传功能</a></li><li><a href="http://www.coolwinds.cn/article/design/1353.htm" title="今天的成果，php邮件订阅功能">今天的成果，php邮件订阅功能</a></li><li><a href="http://www.coolwinds.cn/article/life/1347.htm" title="Hey men, this is my website! Go away!">Hey men, this is my website! Go away!</a></li><li><a href="http://www.coolwinds.cn/article/life/1324.htm" title="更换服务器，网站终于OK了">更换服务器，网站终于OK了</a></li><li><a href="http://www.coolwinds.cn/article/design/1314.htm" title="教你在首页调用ecshop指定分类下的商品">教你在首页调用ecshop指定分类下的商品</a></li><li><a href="http://www.coolwinds.cn/article/life/1304.htm" title="网站PR终于更新了！">网站PR终于更新了！</a></li><li><a href="http://www.coolwinds.cn/article/design/1267.htm" title="换主题啦！">换主题啦！</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.coolwinds.cn/article/design/1331.htm/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>更换服务器，网站终于OK了</title>
		<link>http://www.coolwinds.cn/article/life/1324.htm</link>
		<comments>http://www.coolwinds.cn/article/life/1324.htm#comments</comments>
		<pubDate>Thu, 15 Sep 2011 02:52:23 +0000</pubDate>
		<dc:creator>寒风</dc:creator>
				<category><![CDATA[我的生活]]></category>
		<category><![CDATA[网站]]></category>
		<category><![CDATA[老薛主机]]></category>

		<guid isPermaLink="false">http://www.coolwinds.cn/?p=1324</guid>
		<description><![CDATA[<a href="http://www.coolwinds.cn/article/life" target="_blank"><img src="/wp-content/uploads/img/life.gif" border="0" alt="点击进入我的生活分类！" hspace="0" align="right"></a>之前用的backllc的空间，是在他公司跑路之前买的打折货，40一年，虽然便宜，但问题不断。空间到现在还有半年才到期，现在暂时搁置，看做测试的时候能否用到。

接下来是广告时间：
<blockquote>看到老薛主机又搞团购，特意等到今天来换空间

老薛主机还是不错的，这是我用的第二个老薛收费空间了，如果你还没有参与今天的团购，可以到<a href="http://tuan.admin5.com/deal/211" target="_blank">http://tuan.admin5.com/deal/211</a>去看看，购买优惠券后，所有老薛主机就可以7折优惠了，再加上一次性9折优惠，折上加折，可能是我看到老薛最优惠的一次了。

如果对老薛还不够了解，<a href="http://tuan.admin5.com/deal/211" target="_blank">点击了解老薛</a></blockquote>
换主机后，立马更新了wp到3.2.1版本，后台居然提示我chrome浏览器版本过低，看了我out了。。。]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.coolwinds.cn/article/life" target="_blank"><img src="/wp-content/uploads/img/life.gif" alt="点击进入我的生活分类！" align="right" border="0" hspace="0" /></a>之前用的backllc的空间，是在他公司跑路之前买的打折货，40一年，虽然便宜，但问题不断。空间到现在还有半年才到期，现在暂时搁置，看做测试的时候能否用到。</p>
<p>接下来是广告时间：</p>
<blockquote><p>看到<span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e8%80%81%e8%96%9b%e4%b8%bb%e6%9c%ba" title="查看 老薛主机 中的全部文章" target="_blank">老薛主机</a></span>又搞团购，特意等到今天来换空间</p>
<p><span class='wp_keywordlink_affiliate'><a href="http://www.coolwinds.cn/article/tag/%e8%80%81%e8%96%9b%e4%b8%bb%e6%9c%ba" title="查看 老薛主机 中的全部文章" target="_blank">老薛主机</a></span>还是不错的，这是我用的第二个老薛收费空间了，如果你还没有参与今天的团购，可以到<a href="http://tuan.admin5.com/deal/211" target="_blank">http://tuan.admin5.com/deal/211</a>去看看，购买优惠券后，所有老薛主机就可以7折优惠了，再加上一次性9折优惠，折上加折，可能是我看到老薛最优惠的一次了。</p>
<p><a href="https://my.laoxuehost.com/aff.php?aff=560" target="_blank"><img title="寒风网推荐的老薛主机" src="http://laoxuehost.com/wp-content/uploads/2010/05/150.gif" alt="" /></a></p>
<p>如果对老薛还不够了解，<a href="https://my.laoxuehost.com/aff.php?aff=560" target="_blank">点击了解老薛</a></p>
</blockquote>
<p>换主机后，立马更新了wp到3.2.1版本，后台居然提示我chrome浏览器版本过低，看了我out了。。。</p>
<p>发此文以作纪念</p>
<ul class="related_post"><li><a href="http://www.coolwinds.cn/article/design/1360.htm" title="替换dedeeims的编辑器，增加dede批量图片上传功能">替换dedeeims的编辑器，增加dede批量图片上传功能</a></li><li><a href="http://www.coolwinds.cn/article/design/1353.htm" title="今天的成果，php邮件订阅功能">今天的成果，php邮件订阅功能</a></li><li><a href="http://www.coolwinds.cn/article/life/1347.htm" title="Hey men, this is my website! Go away!">Hey men, this is my website! Go away!</a></li><li><a href="http://www.coolwinds.cn/article/design/1331.htm" title="外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问">外贸网站必备：为ecshop加上IP屏蔽功能，限制ip访问</a></li><li><a href="http://www.coolwinds.cn/article/design/1314.htm" title="教你在首页调用ecshop指定分类下的商品">教你在首页调用ecshop指定分类下的商品</a></li><li><a href="http://www.coolwinds.cn/article/life/1304.htm" title="网站PR终于更新了！">网站PR终于更新了！</a></li><li><a href="http://www.coolwinds.cn/article/design/1267.htm" title="换主题啦！">换主题啦！</a></li><li><a href="http://www.coolwinds.cn/article/design/879.htm" title="今天为网站彻底更换了一个色调">今天为网站彻底更换了一个色调</a></li><li><a href="http://www.coolwinds.cn/article/design/837.htm" title="小博今天的IP有望突破1000大关！">小博今天的IP有望突破1000大关！</a></li><li><a href="http://www.coolwinds.cn/article/life/791.htm" title="好久没上网了~~~~~~~~怀念ing">好久没上网了~~~~~~~~怀念ing</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.coolwinds.cn/article/life/1324.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

