<?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>某人的栖息地 &#187; ajax</title>
	<atom:link href="http://www.ooso.net/category/ajax/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ooso.net</link>
	<description>Linux + Apache + Mysql + Php + Flash</description>
	<lastBuildDate>Mon, 15 Mar 2010 15:59:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>图片预加载效果的实现</title>
		<link>http://www.ooso.net/archives/423</link>
		<comments>http://www.ooso.net/archives/423#comments</comments>
		<pubDate>Sun, 15 Jun 2008 23:25:48 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[picasa]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=423</guid>
		<description><![CDATA[使用picasa的时候，注意到它首先是显示模糊的图片，然后图片突然变得清晰，这样做有一定的好处——picasa的图片翻页是用javascript实现的，如果直接载入大图，中间势必会有个空档，用户在这中间会感觉很空虚~~
于是我花了点时间，打探它的实现方式，发觉很简单，不是用的lowsrc之类的标记，而是简单的js。
代码示例
PLAIN TEXT

				<span class="readmore"><a href="http://www.ooso.net/archives/423" title="图片预加载效果的实现">阅读全文（363字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>使用<a href="http://www.picasaweb.com">picasa</a>的时候，注意到它首先是显示模糊的图片，然后图片突然变得清晰，这样做有一定的好处——picasa的图片翻页是用<a href="/?tag=javascript">javascript</a>实现的，如果直接载入大图，中间势必会有个空档，用户在这中间会感觉很空虚~~</p>
<p>于是我花了点时间，打探它的实现方式，发觉很简单，不是用的lowsrc之类的标记，而是简单的js。</p>
<h3>代码示例</h3>
<div class="igBar"><span id="lcode-2"><a href="#" onclick="javascript:showCodeTxt('code-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-2">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;img id=<span style="color:#CC0000;">"myImage"</span> src=<span style="color:#CC0000;">"small_144.jpg"</span> width=<span style="color:#CC0000;">"640"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var img = new Image<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">img.<span style="">src</span> = <span style="color:#CC0000;">"http://imghost/big_640_480.jpg"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">img.<span style="">onload</span> = function<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; document.<span style="">getElementById</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'myImage'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">src</span> = this.<span style="">src</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>如此这般，待大图载入完成之后，利用js替换原小图的src，就完成了图片预加载效果。关键点是图片的onload事件利用。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/423/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>利用Google Ajax Library API加速常用js类库的载入</title>
		<link>http://www.ooso.net/archives/404</link>
		<comments>http://www.ooso.net/archives/404#comments</comments>
		<pubDate>Wed, 28 May 2008 06:56:58 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/404</guid>
		<description><![CDATA[google前不久推出了Google Ajax Library API，说白了就是提供几个知名js库的host，目前有:

jQuery
prototype

				<span class="readmore"><a href="http://www.ooso.net/archives/404" title="利用Google Ajax Library API加速常用js类库的载入">阅读全文（523字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>google前不久推出了<a href="http://googleajaxsearchapi.blogspot.com/2008/05/speed-up-access-to-your-favorite.html">Google Ajax Library API</a>，说白了就是提供几个知名js库的host，目前有:</p>
<ul>
<li><a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery">jQuery</a></li>
<li><a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#prototype">prototype</a></li>
<li><a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#script_aculo_us">script.aculo.us</a></li>
<li><a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#mootools">MooTools</a></li>
<li><a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#dojo">dojo</a></li>
</ul>
<p><a href="/?tag=google">google</a>提供的这批js类库都有使用cdn，同时提供压缩和非压缩版本，并gzip输出。比如Prototype在未压缩前是124k，压缩后则只有30k，而jquery经过瘦身以后，也是从97k降到了16k。</p>
<p>这项服务的意义在于，如果各个网站都使用google提供的某个js类库比如jquery，那么由于浏览器缓存的缘故，用户就可以避免下载相同内容的js，这样也就能提高js的载入速度了。</p>
<h2>google ajax library api使用方法</h2>
<p><b>传统方式</b></p>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showCodeTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script src=<span style="color:#CC0000;">"http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js"</span>&gt;&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><b>使用google.load载入</b></p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showCodeTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script src=<span style="color:#CC0000;">"http://www.google.com/jsapi"</span>&gt;&lt;/script&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Load jQuery</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">google.<span style="">load</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"jquery"</span>, <span style="color:#CC0000;">"1"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>下面是一段小小的视频用来解释它的工作原理:<br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/4F4Jb1ssEvI&#038;hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/4F4Jb1ssEvI&#038;hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
<h2>Update</h2>
<p>昨天在某个小页面上尝试引入google提供的jquery.min.js，结果让我大失所望，虽然有时候访问速度很快，但是偶尔能刷出22秒以上的响应时间，如果是这样不稳定的话，那么实在是不敢放心使用。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/404/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Ajax Vs Flash</title>
		<link>http://www.ooso.net/archives/353</link>
		<comments>http://www.ooso.net/archives/353#comments</comments>
		<pubDate>Fri, 20 Jul 2007 00:11:01 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/353</guid>
		<description><![CDATA[在RIA应用中,到底应该使用Ajax,还是使用Flash呢?它们各有长处,让人难以取舍.下面就它们的特点做一个小小的总结.

Javascript
+ 不需要额外的插件.

				<span class="readmore"><a href="http://www.ooso.net/archives/353" title="Ajax Vs Flash">阅读全文（282字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在RIA应用中,到底应该使用<a href="index.php?tag=ajax">Ajax</a>,还是使用Flash呢?它们各有长处,让人难以取舍.下面就它们的特点做一个小小的总结.</p>
<ul>
<h1>Javascript</h1>
<li>+ 不需要额外的插件.</li>
<li>- 不同的浏览器下可能会产生不同的行为</li>
<li>- 不能访问音视频设备</li>
<li>- 可能会有少数用户会关闭javascript</li>
<li>- 如果你写的代码很烂,大家都能看到</li>
</ul>
<ul>
<h1>Flash</h1>
<li>- 需要额外安装插件</li>
<li>+ 在各种浏览器上,如果flash player的版本一致,那么flash的行为也会基本一致</li>
<li>- 用户可能不会安装有相同版本的flash player</li>
<li>+ 可以直接访问音视频设备</li>
<li>- 可能会有很多用户屏蔽flash</li>
<li>+ 如果你写的代码很烂,不用担心,大家都看不到</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/353/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Ajax+PHP+YUI手工制作rss阅读器</title>
		<link>http://www.ooso.net/archives/307</link>
		<comments>http://www.ooso.net/archives/307#comments</comments>
		<pubDate>Thu, 05 Jul 2007 00:06:14 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/307</guid>
		<description><![CDATA[上次俺的简陋练习作品Ajax+json小有心得，这次继续尝试利用Ajax+PHP+YUI手工制作rss阅读器。
写一点html来展示RSS的内容
PLAIN TEXT
CODE:

				<span class="readmore"><a href="http://www.ooso.net/archives/307" title="Ajax+PHP+YUI手工制作rss阅读器">阅读全文（736字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>上次俺的<a href="http://www.ooso.net/index.php/archives/160">简陋练习作品Ajax+json</a>小有心得，这次继续尝试利用Ajax+PHP+YUI手工制作rss阅读器。</p>
<h1>写一点html来展示RSS的内容</h1>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showCodeTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;body&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h1&gt;RSS阅读器&lt;/h1&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div id=<span style="color:#CC0000;">"rss_bd"</span>&gt;内容待填补&lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/body&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<span id="more-307"></span></p>
<h1>利用<a href="http://developer.yahoo.com/yui/">YUI</a>的Connection manager来处理XHR</h1>
<p><a href="http://yahoo.cn">yahoo</a>已经提供了在线的YUI Hosting,直接引用:</p>
<div class="igBar"><span id="lcode-11"><a href="#" onclick="javascript:showCodeTxt('code-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-11">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#CC0000;">"text/javascript"</span> src=<span style="color:#CC0000;">"http://yui.yahooapis.com/2.2.2/build/yahoo/yahoo-min.js"</span>&gt;&lt;/script&gt; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#CC0000;">"text/javascript"</span> src=<span style="color:#CC0000;">"http://yui.yahooapis.com/2.2.2/build/connection/connection-min.js"</span>&gt;&lt;/script&gt; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#CC0000;">"text/javascript"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var sUrl = <span style="color:#CC0000;">'proxy.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var callback =</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; success: function<span style="color:#006600; font-weight:bold;">&#40;</span>o<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;document.<span style="">getElementById</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'rss_bd'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">innerHTML</span> = o.<span style="">responseText</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; failure: function<span style="color:#006600; font-weight:bold;">&#40;</span>o<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#008000;">/*failure handler code*/</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var transaction = YAHOO.<span style="">util</span>.<span style="">Connect</span>.<span style="">asyncRequest</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'GET'</span>, sUrl, callback, null<span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>很困，这部分没写完整，下次来补齐。</p>
<h1>用php做一个proxy来避免跨站访问的问题</h1>
<p><strong>proxy的要点</strong><br />
一定要输出header，否则在解析的时候你可能会遇到莫名奇妙的问题。<br />
如果你的服务器不支持远程url open，可以考虑使用curl，比如说在dreamhost的主机上</p>
<div class="igBar"><span id="lcode-12"><a href="#" onclick="javascript:showCodeTxt('code-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-12">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;?php</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$searchUrl = <span style="color:#CC0000;">'http://api.search.yahoo.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&amp;results=4&amp;output=json&amp;query='</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if<span style="color:#006600; font-weight:bold;">&#40;</span>!empty<span style="color:#006600; font-weight:bold;">&#40;</span>$_POST<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'query'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;echo file_get_contents<span style="color:#006600; font-weight:bold;">&#40;</span>$searchUrl . $_POST<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'query'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>到这里，一个简陋的RSS阅读器的雏形已经完备了。</p>
<h1>什么是ajax</h1>
<p>在百度知道上面搜索的答案，一本正经的告诉你：</p>
<blockquote><p>Ajax（Asynchronous JavaScript and XML）是结合了Java技术、XML以及JavaScript等编程技术，可以让开发人员构建基于Java技术的Web应用，并打破了使用页面重载的惯例。 </p></blockquote>
<p>看了后立马一口茶水做雾状均匀喷洒到本本的屏幕上，Ajax本身和java有嘛关系？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/307/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Yahoo搜索大变形</title>
		<link>http://www.ooso.net/archives/316</link>
		<comments>http://www.ooso.net/archives/316#comments</comments>
		<pubDate>Wed, 06 Jun 2007 23:45:27 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/316</guid>
		<description><![CDATA[昨天听说yahoo搜索大变形，跑去试了一下，果然有不同的感受。首页就不说啦，没啥值得浪费口水的，搜索结果页面有巨大变化：

每次只显示五条结果
翻页放在右侧纵向排列

				<span class="readmore"><a href="http://www.ooso.net/archives/316" title="Yahoo搜索大变形">阅读全文（314字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>昨天听说<a href="http://www.yahoo.cn">yahoo</a>搜索大变形，跑去试了一下，果然有不同的感受。首页就不说啦，没啥值得浪费口水的，搜索结果页面有巨大变化：</p>
<ul>
<li>每次只显示五条结果</li>
<li>翻页放在右侧纵向排列</li>
<li>左青龙（相关搜索词）右白虎（图片，音乐，博客等相关）内容在中间</li>
</ul>
<p>让人惊讶的是翻页非常快，点点就出来了，我要是用鼠标在右边翻页一直点下去咋办？那会没完。祭出<a href="index.php?tag=firebug">firebug</a>窥探之，每一次翻页均会有一个ajax提交: </p>
<blockquote><p>POST http://www.yahoo.cn/data:foo (656ms)</p></blockquote>
<p>正如我们看到的，post方式的提交，返回了一堆乱遭遭的数据，以我有限的知识看来，这八成是json格式。翻页还支持快捷键，j/k 控制上下翻，八成是vim的爱好者干的好事，没说的。</p>
<h1>用着挺爽</h1>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/316/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>greasemonkey内置了ajax管理器</title>
		<link>http://www.ooso.net/archives/283</link>
		<comments>http://www.ooso.net/archives/283#comments</comments>
		<pubDate>Tue, 22 May 2007 00:03:32 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[greasemonkey]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/283</guid>
		<description><![CDATA[greasemonkey这工具，就好像web开发人员的作弊器一样，好玩。经常去的网站，若是看着不顺眼，就祭出greasemonkey对它页面元素的位置调整一番，把主题内容字体搞大，把广告隐藏不见，别人的网站我做主，倒也有一番小小乐趣（我可没有hack它的站点哦）。这些天看看文档，原来人家已经内置了xmlhttpRequest的api,不用费牛劲去外部导入一些js来搞这些基础工程了。
Description
GM_xmlhttpRequest makes an arbitrary HTTP request. The details argument is an object that can contain up to seven fields. 

				<span class="readmore"><a href="http://www.ooso.net/archives/283" title="greasemonkey内置了ajax管理器">阅读全文（764字）</a></span>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ooso.net/index.php?tag=greasemonkey">greasemonkey</a>这工具，就好像web开发人员的作弊器一样，好玩。经常去的网站，若是看着不顺眼，就祭出greasemonkey对它页面元素的位置调整一番，把主题内容字体搞大，把广告隐藏不见，别人的网站我做主，倒也有一番小小乐趣（我可没有hack它的站点哦）。这些天看看文档，原来人家已经内置了xmlhttpRequest的api,不用费牛劲去外部导入一些js来搞这些基础工程了。</p>
<blockquote><p>Description</p>
<p>GM_xmlhttpRequest makes an arbitrary HTTP request. The details argument is an object that can contain up to seven fields. </p></blockquote>
<h2>一个greasemonkey的ajax调用</h2>
<div class="igBar"><span id="lcode-14"><a href="#" onclick="javascript:showCodeTxt('code-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-14">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GM_xmlhttpRequest<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; method: <span style="color:#CC0000;">'GET'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; url: <span style="color:#CC0000;">'http://greaseblog.blogspot.com/atom.xml'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; headers: <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">'User-agent'</span>: <span style="color:#CC0000;">'Mozilla/4.0 (compatible) </span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">Greasemonkey'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">'Accept'</span>: </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">'application/atom+xml,application/xml,text/xml'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; onload: function<span style="color:#006600; font-weight:bold;">&#40;</span>responseDetails<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; alert<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'Request for Atom feed returned '</span> + </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">responseDetails.<span style="">status</span> +</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">' '</span> + responseDetails.<span style="">statusText</span> + <span style="color:#CC0000;">'<span style="color:#000099; font-weight:bold;">\n</span><span style="color:#000099; font-weight:bold;">\n</span>'</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">+</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0000;">'Feed data:<span style="color:#000099; font-weight:bold;">\n</span>'</span> + </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">responseDetails.<span style="">responseText</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>较详细一些的内容，可以去<a href="http://diveintogreasemonkey.org/">Dive Into Greasemonkey</a>查阅.</p>
<p><a href="http://www.ooso.net/du/?p=70">什么是greasemonkey?</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/283/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pear::Pager和AJAX的整合应用</title>
		<link>http://www.ooso.net/archives/260</link>
		<comments>http://www.ooso.net/archives/260#comments</comments>
		<pubDate>Sun, 22 Oct 2006 23:53:07 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/260</guid>
		<description><![CDATA[作为一个PHP开发人员来说，大概很让人受用的一个东东就是Pear的类库了。我们知道，Pear::Pager是专门处理分页的，而Pear::HTML_AJAX则是Ajax应用的一些类库。但是Pager也不仅仅是只能用于html的分页链接，它已经为比超女还红的Ajax做好了准备，下面看看这两个包如何整合应用。
Pager and Javascript
现在走出第一步，Pager已经能够构建出javascript的链接了，和Ajax整合，理论上应该也是能够实现的，下面是Pager和javascript分页的一个例子：

				<span class="readmore"><a href="http://www.ooso.net/archives/260" title="Pear::Pager和AJAX的整合应用">阅读全文（1125字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>作为一个PHP开发人员来说，大概很让人受用的一个东东就是<a href="http://www.ooso.net/index.php/archives/category/pear/">Pear</a>的类库了。我们知道，Pear::<a href="http://www.ooso.net/index.php/archives/250">Pager</a>是专门处理分页的，而Pear::<a href="http://www.ooso.net/index.php/archives/184">HTML_AJAX</a>则是Ajax应用的一些类库。但是Pager也不仅仅是只能用于html的分页链接，它已经为比超女还红的Ajax做好了准备，下面看看这两个包如何整合应用。</p>
<h3>Pager and Javascript</h3>
<p>现在走出第一步，Pager已经能够构建出<a href="http://www.ooso.net/index.php/archives/category/javascript/">javascript</a>的链接了，和Ajax整合，理论上应该也是能够实现的，下面是Pager和javascript分页的一个例子：</p>
<div class="igBar"><span id="lphp-19"><a href="#" onclick="javascript:showCodeTxt('php-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-19">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'Pager/Pager.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$data</span> = <span style="color:#000066;">range</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span>, <span style="color:#CC66CC;color:#800000;">100</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">//an array of data to paginate</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager_params</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'mode'</span>&nbsp; &nbsp; &nbsp;=&gt; <span style="color:#FF0000;">'Sliding'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'append'</span>&nbsp; &nbsp;=&gt; <span style="color:#000000; font-weight:bold;">false</span>,&nbsp; <span style="color:#FF9933; font-style:italic;">//don't append the GET parameters to the url</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'path'</span>&nbsp; &nbsp; &nbsp;=&gt; <span style="color:#FF0000;">''</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'fileName'</span> =&gt; <span style="color:#FF0000;">'javascript:revealDiv(%d)'</span>,&nbsp; <span style="color:#FF9933; font-style:italic;">//Pager replaces &quot;%d&quot; with the page number...</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'perPage'</span>&nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">10</span>, <span style="color:#FF9933; font-style:italic;">//show 10 items per page</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'delta'</span>&nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">5</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'itemData'</span> =&gt; <span style="color:#0000FF;">$data</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager</span> = &amp; Pager::<span style="color:#006600;">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager_params</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$n_pages</span> = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">numPages</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$links</span> = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getLinks</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;html&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;head&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;script type=<span style="color:#FF0000;">"text/javascript"</span> language=<span style="color:#FF0000;">"javascript"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> n_pages = <span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$n_pages</span> <span style="color:#000000; font-weight:bold;">?&gt;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> revealDiv<span style="color:#006600; font-weight:bold;">&#40;</span>n<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">for</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">var</span> <span style="color:#000066;">count</span> = <span style="color:#CC66CC;color:#800000;">1</span>; <span style="color:#000066;">count</span> &lt;= n_pages; <span style="color:#000066;">count</span>++<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"page"</span>+<span style="color:#000066;">count</span><span style="color:#006600; font-weight:bold;">&#41;</span>.style.display = <span style="color:#FF0000;">'none'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"page"</span>+n<span style="color:#006600; font-weight:bold;">&#41;</span>.style.display = <span style="color:#FF0000;">'block'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">&lt;/script&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;style type=<span style="color:#FF0000;">"text/css"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; div.page <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; background: <span style="color:#008000; font-style:italic;">#FFFF99;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; border-top: 1px solid <span style="color:#008000; font-style:italic;">#FFBF99;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; border-bottom: 1px solid <span style="color:#008000; font-style:italic;">#FFBF99;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/style&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/head&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;body&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h1&gt;PEAR::<span style="color:#006600;">Pager</span> example with JavaScript&lt;/h1&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$links</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'pages'</span><span style="color:#006600; font-weight:bold;">&#93;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;hr /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">for</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$i</span>=<span style="color:#CC66CC;color:#800000;">1</span>; <span style="color:#0000FF;">$i</span> &lt;= <span style="color:#0000FF;">$n_pages</span>; ++<span style="color:#0000FF;">$i</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;div class=&quot;page&quot; id=&quot;page'</span>.<span style="color:#0000FF;">$i</span>.<span style="color:#FF0000;">'&quot;&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;h2&gt;Page '</span>.<span style="color:#0000FF;">$i</span>.<span style="color:#FF0000;">'&lt;/h2&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getPageData</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$i</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$item</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#FF0000;">'Item '</span>.<span style="color:#0000FF;">$item</span>.<span style="color:#FF0000;">'&lt;br /&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;/div&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;hr /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#FF0000;">"text/javascript"</span> language=<span style="color:#FF0000;">"javascript"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">revealDiv<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;/script&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/body&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/html&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>例子中把分页的所有数据放入一个div标签，定义了两个比较重要的参数就是path（为空）和fileName,fileName原本应该是链接的文件名，但是这里用javascript替换了。</p>
<h3>Ajax上阵</h3>
<p>这个例子包括三个文件page.html,server.php,testdata.php<br />
<span id="more-260"></span></p>
<li>page.html</li>
<p>用动态javascript--server.php来处理数据，调用HTML_AJAX.replace('target', 'testdata.php')来替换id为target这个div的内容。</p>
<div class="igBar"><span id="lphp-20"><a href="#" onclick="javascript:showCodeTxt('php-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-20">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;html&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;body&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h1&gt;PEAR::<span style="color:#006600;">Pager</span> example with AJAX&lt;/h1&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#FF0000;">"text/javascript"</span> src=<span style="color:#FF0000;">"server.php?client=all"</span>&gt;&lt;/script&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div id=<span style="color:#FF0000;">"target"</span>&gt;I<span style="color:#FF0000;">'m the target&lt;/div&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&lt;script type=&quot;text/javascript&quot;&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; HTML_AJAX.replace('</span>target<span style="color:#FF0000;">', '</span>testdata.php<span style="color:#FF0000;">');</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&lt;/script&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&lt;/body&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&lt;/html&gt; </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<li>testdata.php</li>
<p>这是个很简单的php程序，取到分页数据并输出html</p>
<div class="igBar"><span id="lphp-21"><a href="#" onclick="javascript:showCodeTxt('php-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-21">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'Pager/Pager.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$data</span> = <span style="color:#000066;">range</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span>, <span style="color:#CC66CC;color:#800000;">100</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">//an array of data to paginate</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager_params</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'mode'</span>&nbsp; &nbsp; &nbsp;=&gt; <span style="color:#FF0000;">'Sliding'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'append'</span>&nbsp; &nbsp;=&gt; <span style="color:#000000; font-weight:bold;">false</span>,&nbsp; <span style="color:#FF9933; font-style:italic;">//don't append the GET parameters to the url</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'path'</span>&nbsp; &nbsp; &nbsp;=&gt; <span style="color:#FF0000;">''</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'fileName'</span> =&gt; <span style="color:#FF0000;">'javascript:HTML_AJAX.replace(<span style="color:#000099; font-weight:bold;">\'</span>target<span style="color:#000099; font-weight:bold;">\'</span>,<span style="color:#000099; font-weight:bold;">\'</span>testdata.php?pageID=%d<span style="color:#000099; font-weight:bold;">\'</span>);'</span>,&nbsp; <span style="color:#FF9933; font-style:italic;">//Pager replaces &quot;%d&quot; with the page number...</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'perPage'</span>&nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">10</span>, <span style="color:#FF9933; font-style:italic;">//show 10 items per page</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'delta'</span>&nbsp; &nbsp; =&gt; <span style="color:#CC66CC;color:#800000;">1</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">'itemData'</span> =&gt; <span style="color:#0000FF;">$data</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pager</span> = &amp; Pager::<span style="color:#006600;">factory</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager_params</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$n_pages</span> = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">numPages</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$links</span> = <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getLinks</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;p&gt;This container is loaded with an AJAX call&lt;/p&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;p&gt;&lt;span class=&quot;datetime&quot;&gt;DateTime: '</span>. <span style="color:#000066;">date</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Y-m-d H:i:s'</span><span style="color:#006600; font-weight:bold;">&#41;</span> .<span style="color:#FF0000;">'&lt;/span&gt;&lt;/p&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;h3&gt;Page '</span>. <span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getCurrentPageId</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> .<span style="color:#FF0000;">'&lt;/h3&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">getPageData</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$item</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#FF0000;">'Item '</span>. <span style="color:#0000FF;">$item</span> .<span style="color:#FF0000;">'&lt;br /&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#FF0000;">'&lt;hr /&gt;'</span>.<span style="color:#0000FF;">$pager</span>-&gt;<span style="color:#006600;">links</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<li>最后，贴上幕后工作者server.php的代码</li>
<p>用HTML_AJAX_Server来处理ajax这些烦心事吧</p>
<div class="igBar"><span id="lphp-22"><a href="#" onclick="javascript:showCodeTxt('php-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-22">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span> <span style="color:#FF0000;">'HTML/AJAX/Server.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$server</span> = <span style="color:#000000; font-weight:bold;">new</span> HTML_AJAX_Server<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$server</span>-&gt;<span style="color:#006600;">handleRequest</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>web 2.0, Ajax的趋势图</h3>
<p>时下的web 2.0和Ajax概念正是如火如荼，且不论Ajax这东东到底是不是炒作的产物，就实际应用来说，Ajax在某些场合的确是顶好用而且看上去挺酷.</p>
<p><strong>蓝的是web 2.0,红的是Ajax</strong><br />
<img src="http://www.google.com/trends/viz?q=web+2.0,ajax&#038;date=all&#038;geo=all&#038;graph=weekly_img&#038;sa=N" alt="web 2.0,ajax" /></p>
<h3>参考文档</h3>
<p>http://www.alberton.info/pear_pager_tutorial_javascript_navigation.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/260/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Connection Manager  Of YUI</title>
		<link>http://www.ooso.net/archives/242</link>
		<comments>http://www.ooso.net/archives/242#comments</comments>
		<pubDate>Mon, 11 Sep 2006 15:29:37 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/242</guid>
		<description><![CDATA[前些天试用了Yahoo! UI Library的Connection Manager工具，略有些心得，这里丢块板砖出来，能不能引到玉，那是后话。
Connection Manager能干什么
The Connection Manager is a utility that enables you to make in-page HTTP requests through a simplified interface to the XMLHttpRequest object. The Connection Manager handles cross-browser instantiation of XMLHttpRequest, negotiates the server response and uses a callback pattern to process the response data.

				<span class="readmore"><a href="http://www.ooso.net/archives/242" title="Connection Manager  Of YUI">阅读全文（1018字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>前些天试用了Yahoo! UI Library的Connection Manager工具，略有些心得，这里丢块板砖出来，能不能引到玉，那是后话。</p>
<h3>Connection Manager能干什么</h3>
<blockquote><p>The Connection Manager is a utility that enables you to make in-page HTTP requests through a simplified interface to the XMLHttpRequest object. The Connection Manager handles cross-browser instantiation of XMLHttpRequest, negotiates the server response and uses a callback pattern to process the response data.</p></blockquote>
<p>没话说，这是一个<a href="http://www.ooso.net/index.php/archives/category/ajax/">ajax</a>的<a href="http://www.ooso.net/index.php/archives/category/javascript/">javascript</a>类库，<a href="http://www.yahoo.cn">Yahoo</a>出品，嘿嘿。</p>
<h3>使用心得</h3>
<ul>
<li>打开程序包的build/connection目录，下有connection.js,connection-debug.js,connection-min.js,这三个文件其实内容都一样，第一个是正儿八经的源代码，中间那个不用说可以用于debug,最后那个也不是废柴，它经过压缩处理，javascript代码仅仅只有8k，相对connection.js高达20k肥硕体积来说，显然更经济，可用于线上系统。</li>
<li>这三个文件最好都要的：
<div class="igBar"><span id="lcode-25"><a href="#" onclick="javascript:showCodeTxt('code-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-25">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!-- Dependency --&gt;&nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script src=<span style="color:#CC0000;">"yahoo.js"</span>&gt;&lt;/script&gt;&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!-- OPTIONAL: Required if using setForm<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> to upload files --&gt;&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script src=<span style="color:#CC0000;">"event.js"</span>&gt;&lt;/script&gt;&nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!-- Source file --&gt;&nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script src=<span style="color:#CC0000;">"connection.js"</span>&gt;&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>最后说个特好用的方法 —— setForm，这功能可以解析某个表单的内容，自动拼凑出用于ajax提交的数据串，甚至可以用于文件上传，实在是居家旅行必备。
<div class="igBar"><span id="lcode-26"><a href="#" onclick="javascript:showCodeTxt('code-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-26">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var formObject = document.<span style="">getElementById</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'aForm'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">YAHOO.<span style="">util</span>.<span style="">Connect</span>.<span style="">setForm</span><span style="color:#006600; font-weight:bold;">&#40;</span>formObject<span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// This example facilitates a POST transaction.&nbsp; &nbsp;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var cObj = YAHOO.<span style="">util</span>.<span style="">Connect</span>.<span style="">asyncRequest</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'POST'</span>, <span style="color:#CC0000;">'http://www.yahoo.com'</span>, callback<span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
</li>
</ul>
<h3>详细说明</h3>
<p>http://developer.yahoo.com/yui/connection/</p>
<p>这阵子犯懒，只字未写，惭愧惭愧</p>
<p><strong>版权声明：可以任意转载，转载时请务必以超链接形式标明文章原始出处和作者信息及本声明</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/242/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用php5来赚大钱</title>
		<link>http://www.ooso.net/archives/210</link>
		<comments>http://www.ooso.net/archives/210#comments</comments>
		<pubDate>Thu, 03 Aug 2006 00:33:48 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[优化]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/210</guid>
		<description><![CDATA[写这个标题一定会被打死。
可能这个幻灯跟赚钱没关系－－Getting Rich with PHP 5(IE之外的浏览器可看)。但是个人认为它所介绍的程序优化和分析的方法比较有意思，广大php爱好者如能掌握，说不定真的就解决了温饱问题进而赚了大钱。
幻灯的大义：
首先你准备建一个大流量的网站

				<span class="readmore"><a href="http://www.ooso.net/archives/210" title="用php5来赚大钱">阅读全文（397字）</a></span>]]></description>
			<content:encoded><![CDATA[<h2>写这个标题一定会被打死。</h2>
<p>可能这个幻灯跟赚钱没关系－－<a href="http://talks.php.net/show/oscon06">Getting Rich with PHP 5</a>(IE之外的浏览器可看)。但是个人认为它所介绍的程序优化和分析的方法比较有意思，广大php爱好者如能掌握，说不定真的就解决了温饱问题进而赚了大钱。</p>
<p>幻灯的大义：</p>
<h3>首先你准备建一个大流量的网站</h3>
<p>这个网站真的很大，可能会有这些特点：</p>
<ul>
<li>web 2.0的亲戚</li>
<li>有tag系统</li>
<li>ajax用的港港的，溜的很</li>
<li>有500000活跃用户</li>
<li>等等。。。</li>
</ul>
<p>初步估计这个流量大概是：<br />
平均:578次访问/秒<br />
峰值:578 x 3 = 1700次访问/秒</p>
<p>而且这个网站是用Linux+Apache+<a href="http://www.ooso.net/index.php/archives/category/php/">PHP</a>做的，怎么样？头大了吧。<br />
怎么样用尽可能少的资源，服务更多的人群呢？这就是这个幻灯的最终效果，省下了服务器，也就是赚了钱，对吧？至于您的50万流量的网站有没有转下去并因此赚了钱，那是另外一回事。</p>
<h3>用到的关键词</h3>
<p>Postgresql,<a href="http://www.ooso.net/index.php/archives/category/mysql/">Mysql</a>,APC,Callgrind</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/210/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>试用google search的Ajax api</title>
		<link>http://www.ooso.net/archives/185</link>
		<comments>http://www.ooso.net/archives/185#comments</comments>
		<pubDate>Fri, 02 Jun 2006 14:24:51 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/185</guid>
		<description><![CDATA[最近两个月访问google老抽风，也8知道伟大的GFW使了些什么手段。虽然形式不容乐观，仍然是看到了狗狗发布了google adsense api和google search ajax  api,显然后者更具有实用价值。因此俺用迅雷不及掩耳盗铃之势申请了api key,在参考了online manual之后，还是用实际代码说话吧：
PLAIN TEXT
JAVASCRIPT:


				<span class="readmore"><a href="http://www.ooso.net/archives/185" title="试用google search的Ajax api">阅读全文（955字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>最近两个月访问google老抽风，也8知道伟大的GFW使了些什么手段。虽然形式不容乐观，仍然是看到了狗狗发布了google adsense api和<a href="http://code.google.com/apis/ajaxsearch/">google search ajax  api,</a>显然后者更具有实用价值。因此俺用迅雷不及掩耳盗铃之势申请了<a href="http://code.google.com/apis/ajaxsearch/signup.html">api key</a>,在参考了<a href="http://code.google.com/apis/ajaxsearch/documentation/">online manual</a>之后，还是用实际代码说话吧：</p>
<div class="igBar"><span id="ljavascript-28"><a href="#" onclick="javascript:showCodeTxt('javascript-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-28">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #000066;">OnLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Create a search control</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> searchControl = <span style="color: #003366; font-weight: bold;">new</span> GSearchControl<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// 搜索选项，这里设置为自动展开 </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> options = <span style="color: #003366; font-weight: bold;">new</span> GsearcherOptions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; options.<span style="color: #006600;">setExpandMode</span><span style="color: #66cc66;">&#40;</span>GSearchControl.<span style="color: #006600;">EXPAND_MODE_OPEN</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// 添加了一个网页搜索</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; searchControl.<span style="color: #006600;">addSearcher</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> GwebSearch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, options<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// 搜索结果输出选项，列表显示 GSearchControl.DRAW_MODE_TABED是另外一个选项，tab方式显示各种搜索结果</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> drawOptions = <span style="color: #003366; font-weight: bold;">new</span> GdrawOptions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; drawOptions.<span style="color: #006600;">setDrawMode</span><span style="color: #66cc66;">&#40;</span>GSearchControl.<span style="color: #006600;">DRAW_MODE_LINEAR</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// 每次显示8条搜索结果</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; searchControl.<span style="color: #006600;">setResultSetSize</span><span style="color: #66cc66;">&#40;</span>GSearch.<span style="color: #006600;">LARGE_RESULTSET</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Tell the searcher to draw itself and tell it where to attach</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; searchControl.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"searchcontrol"</span><span style="color: #66cc66;">&#41;</span>, drawOptions<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// 开始搜索</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; searchControl.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"Google"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>目前这个api的版本是0.1,正式版1.0发布之后，搜索结果将会有广告显示，显然这个午餐不免费。</p>
<ul>
<li>这里<a href="http://www.ooso.net/temp/demo/search.html">我写的demo(如果不能访问，说明google又开始抽风了) - http://www.ooso.net/temp/demo/search.html</a></li>
<li><a href="http://code.google.com/apis/ajaxsearch/samples.html">Google AJAX Search API例子</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/185/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用php将rss转化为json格式</title>
		<link>http://www.ooso.net/archives/184</link>
		<comments>http://www.ooso.net/archives/184#comments</comments>
		<pubDate>Mon, 29 May 2006 06:41:38 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[json]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/184</guid>
		<description><![CDATA[要用php将rss转换成json,简单的转换思路是:
rss -> php array -> json
我们不必从头进行这些工作,pear已经提供了一些可用的类库,到命令行下面利用pear安装这些包
pear install channel://pear.php.net/XML_RSS-0.9.9

				<span class="readmore"><a href="http://www.ooso.net/archives/184" title="用php将rss转化为json格式">阅读全文（453字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>要用php将rss转换成json,简单的转换思路是:<br />
rss -> php array -> json</p>
<p>我们不必从头进行这些工作,pear已经提供了一些可用的类库,到命令行下面利用pear安装这些包<br />
pear install channel://pear.php.net/XML_RSS-0.9.9<br />
pear install channel://pear.php.net/HTML_AJAX-0.4.0</p>
<p>下面是一个简单的测试代码:</p>
<div class="igBar"><span id="lphp-30"><a href="#" onclick="javascript:showCodeTxt('php-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-30">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> <span style="color:#FF0000;">'XML/RSS.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require</span> <span style="color:#FF0000;">'HTML/AJAX/JSON.PHP'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rss</span> = <span style="color:#000000; font-weight:bold;">new</span> XML_RSS<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'http://www.ooso.net/index.php/feed/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rss</span>-&gt;<span style="color:#006600;">parse</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//var_dump($rss-&gt;getItems());</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$json</span> = <span style="color:#000000; font-weight:bold;">new</span> HTML_AJAX_JSON<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$js</span> = <span style="color:#0000FF;">$json</span>-&gt;<span style="color:#006600;">encode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$rss</span>-&gt;<span style="color:#006600;">getItems</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">echo</span> <span style="color:#0000FF;">$js</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<ul>
<li><a href="http://www.yahoo.com.cn/search?p=json">什么是json?</a></li>
<li><a href="http://www.google.com/search?q=site%3Awww.ooso.net+json">相关文章</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/184/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>php+ajax文件上传进度条</title>
		<link>http://www.ooso.net/archives/169</link>
		<comments>http://www.ooso.net/archives/169#comments</comments>
		<pubDate>Wed, 15 Mar 2006 02:39:50 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/169</guid>
		<description><![CDATA[找到一篇文章PHP AJAX File Upload Progress Meter Updates,介绍如何用php Pear:HTML_AJAX制作带有进度条的文件上传,下面是我测试上传时的示意图
 

代码分为以下部分:

				<span class="readmore"><a href="http://www.ooso.net/archives/169" title="php+ajax文件上传进度条">阅读全文（990字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>找到一篇文章<a href="http://blog.joshuaeichorn.com/archives/2006/03/14/php-ajax-file-upload-progress-meter-updates/" target="_blank">PHP AJAX File Upload Progress Meter Updates</a>,介绍如何用<a href="http://www.php.net" target="_blank">php</a> <a href="http://pear.php.net/package/HTML_AJAX" target="_blank">Pear:HTML_AJAX</a>制作带有进度条的文件上传,下面是我测试上传时的示意图</p>
<p><img title="ajax带进度条上传" alt="ajax带进度条上传" src="http://image.blog.myrice.com/vvvv/imgs/0/8/08c345da.gif" /> </p>
<p><span id="more-169"></span><br />
代码分为以下部分:</p>
<p>demo.php - 上传过程处理</p>
<div class="igBar"><span id="lphp-35"><a href="#" onclick="javascript:showCodeTxt('php-35'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-35">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span> <span style="color:#FF0000;">'UploadProgressMeter.class.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$fileWidget</span> = <span style="color:#000000; font-weight:bold;">new</span> UploadProgressMeter<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fileWidget</span>-&gt;<span style="color:#006600;">uploadComplete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// 上传完毕的时候,从iframe发送一个js到主窗口表示一切ok</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">echo</span> <span style="color:#0000FF;">$fileWidget</span>-&gt;<span style="color:#006600;">finalStatus</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// 处理上传后的文件...</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">exit</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>demoserver.php - ajax的服务端js,使用Pear:HTML_AJAX,直接调用UploadProgressMeterStatus类</p>
<div class="igBar"><span id="lhtml-36"><a href="#" onclick="javascript:showCodeTxt('html-36'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-36">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://www.ooso.net/demoserver.php?client=main,request,httpclient,dispatcher,json,util"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://www.ooso.net/demoserver.php?stub=UploadProgressMeterStatus"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php echo $fileWidget-<span style="color: #000000; font-weight: bold;">&gt;</span></span>renderIncludeJs(); ?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>进度条的样式表</p>
<div class="igBar"><span id="lcss-37"><a href="#" onclick="javascript:showCodeTxt('css-37'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-37">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.progressBar </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">relative</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">padding</span>: 2px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">width</span>: 300px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">height</span>: 40px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">font-size</span>: 14px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.progressBar </span><span style="color: #6666ff;">.<span style="color: #000000; font-weight: bold;">background</span> </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">border</span>: <span style="color: #993333;">solid</span> 1px <span style="color: #000000; font-weight: bold;">black</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">width</span>: 270px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">height</span>: 20px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.progressBar </span><span style="color: #6666ff;">.bar </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">relative</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">background-color</span>: <span style="color: #000000; font-weight: bold;">blue</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">width</span>: 0px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">height</span>: 20px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>表单部分</p>
<div class="igBar"><span id="lhtml-38"><a href="#" onclick="javascript:showCodeTxt('html-38'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-38">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">"demo.php"</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">"post"</span> <span style="color: #000066;">enctype</span>=<span style="color: #ff0000;">"multipart/form-data"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>renderFormExtra(); ?&gt;&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php echo $fileWidget-<span style="color: #000000; font-weight: bold;">&gt;</span></span>renderHidden(); ?&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">"demo.php"</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">"post"</span> <span style="color: #000066;">enctype</span>=<span style="color: #ff0000;">"multipart/form-data"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;label&gt;</span></span>Select File: <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php echo $fileWidget-<span style="color: #000000; font-weight: bold;">&gt;</span></span>render(); ?&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php echo $fileWidget-<span style="color: #000000; font-weight: bold;">&gt;</span></span>renderProgressBar(); ?&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><a href="http://www.ooso.net/temp/demo/upload.rar" target="_blank">demo下载</a> - 密码是<a href="http://www.ooso.net/">www.ooso.net</a><br />
作者的<a href="http://svn.bluga.net/HTML_AJAX/UploadProgressMeter/trunk/" target="_blank">svn浏览</a></p>
<p>其它类似项目:<br />
<a href="http://pdoru.from.ro/">http://pdoru.from.ro/</a> - 要以patch的形式和php一起编译<br />
<a href="http://www.ugia.cn/?p=54">http://www.ugia.cn/?p=54</a> - 以socket上传文件并显示进度条</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/169/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>apache的rewrite &#8211; 代理吞吐(Proxy Throughput)功能</title>
		<link>http://www.ooso.net/archives/168</link>
		<comments>http://www.ooso.net/archives/168#comments</comments>
		<pubDate>Tue, 14 Mar 2006 13:13:15 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/168</guid>
		<description><![CDATA[今天尝试使用apache的rewrite作为ajax跨域调用代理,要用到rewrite的Proxy Throughput功能.翻看apache手册,看上去不算太复杂,只要用flag [P]就可以映射远程页面甚至整个远程网络区域到自己的名称空间.照着手册上写了个配置:
RewriteEngine On
RewriteRule ^/proxy/(.*)$ http://$1 [P,L]
我想通过上面的url重写达到这样的效果,使用代理功能访问http://www.mysite.com/proxy/www.destsite.com,自动使用代理访问www.destsite.com, url不改变.重启apache后,进行测试,始终是无法访问,于是开启rewrite日志:

				<span class="readmore"><a href="http://www.ooso.net/archives/168" title="apache的rewrite &#8211; 代理吞吐(Proxy Throughput)功能">阅读全文（597字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>今天尝试使用apache的rewrite作为ajax跨域调用代理,要用到rewrite的Proxy Throughput功能.翻看apache手册,看上去不算太复杂,只要用flag <code><font face="Courier New">[P]就可以</font></code>映射远程页面甚至整个远程网络区域到自己的名称空间.照着手册上写了个配置:</p>
<p>RewriteEngine On<br />
RewriteRule ^/proxy/(.*)$ <a href="http://$1/">http://$1</a> [P,L]</p>
<p>我想通过上面的url重写达到这样的效果,使用代理功能访问http://www.mysite.com/proxy/www.destsite.com,自动使用代理访问www.destsite.com, url不改变.重启apache后,进行测试,始终是无法访问,于是开启rewrite日志:</p>
<p>RewriteLogLevel 9<br />
RewriteLog logs/rewrite.log</p>
<p>日志中显示已经正确转向到<a href="http://www.destsite.com/">www.destsite.com</a>,但是仍然无法访问.郁闷的很,找这边的网管大哥讨教,被告知要开启proxy功能,否则rewrite的Proxy Throughput功能无法使用.于是修改httpd.conf,加入两行:</p>
<p>LoadModule proxy_module modules/mod_proxy.so<br />
LoadModule proxy_http_module modules/mod_proxy_http.so</p>
<p>重启apache测试,一切ok</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/168/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>当ajax遭遇系统错误: -1072896658</title>
		<link>http://www.ooso.net/archives/167</link>
		<comments>http://www.ooso.net/archives/167#comments</comments>
		<pubDate>Mon, 13 Mar 2006 07:29:24 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/167</guid>
		<description><![CDATA[上个礼拜整了个ajax调用yahoo搜索的demo,不想有网友发现search.htm会报javascript错 --- 系统错误: -1072896658.
他的服务器环境是apache 2.05+php4.3+ie6/firefox 1.07+windows server 2003,而我的服务器环境是apache 2.2+php5.1.2/php4.3+ie6/firefox 1.07+winxp.这个时候俺几乎就要把所有的错归结到windows server 2003身上了.但是对方可以正常查看我放在网上的demo,所以这跟windows的亲戚应该没太大干系,用-1072896658作为关键字google了一下,很快有了答案.

				<span class="readmore"><a href="http://www.ooso.net/archives/167" title="当ajax遭遇系统错误: -1072896658">阅读全文（552字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>上个礼拜整了个<a href="http://www.ooso.net/index.php/archives/160" target="_blank">ajax调用yahoo搜索的demo</a>,不想有网友发现search.htm会报javascript错 --- <strong>系统错误: -1072896658</strong>.</p>
<p>他的服务器环境是apache 2.05+php4.3+ie6/firefox 1.07+windows server 2003,而我的服务器环境是apache 2.2+php5.1.2/php4.3+ie6/firefox 1.07+winxp.这个时候俺几乎就要把所有的错归结到windows server 2003身上了.但是对方可以正常查看我放在网上的demo,所以这跟windows的亲戚应该没太大干系,用-1072896658作为关键字google了一下,很快有了答案.<br />
<a href="http://www.panoramio.com/blog/explorer-system-error-1072896658/">http://www.panoramio.com/blog/explorer-system-error-1072896658/</a></p>
<p>如果XMLHttpRequest对象请求的文档未指定正确的utf-8编码,就会出现这个错误<br />
<strong>浏览器系统错误:-1072896658</strong>(Explorer system error: -1072896658)</p>
<p>解决办法很简单,给代理proxy.php加上简单的一行就一切ok:</p>
<div class="igBar"><span id="lphp-40"><a href="#" onclick="javascript:showCodeTxt('php-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-40">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000066;">header</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'text/javascript; charset=utf-8'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/167/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>js中的template &#8212; Jemplate</title>
		<link>http://www.ooso.net/archives/164</link>
		<comments>http://www.ooso.net/archives/164#comments</comments>
		<pubDate>Fri, 10 Mar 2006 02:53:19 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/164</guid>
		<description><![CDATA[最近在调试ajax程序的时候,要格式化数据输出html,代码比较混乱,这时候就比较怀念php里可以用到的各式各样的模板.然而js毕竟是很强大的,俺找到了这个javascript写的template类 -- Jemplate,用法还算简单.
首先得包含必要的文件:
PLAIN TEXT
HTML:

				<span class="readmore"><a href="http://www.ooso.net/archives/164" title="js中的template &#8212; Jemplate">阅读全文（817字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>最近在调试ajax程序的时候,要格式化数据输出html,代码比较混乱,这时候就比较怀念php里可以用到的各式各样的模板.然而js毕竟是很强大的,俺找到了这个javascript写的template类 -- Jemplate,用法还算简单.</p>
<p>首先得包含必要的文件:</p>
<div class="igBar"><span id="lhtml-47"><a href="#" onclick="javascript:showCodeTxt('html-47'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-47">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">language</span>=<span style="color: #ff0000;">"javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"./prototype.js"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">language</span>=<span style="color: #ff0000;">"javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"./lyase_view.js"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>模板可以写在当前html里,也可以写在单独的模板文件:</p>
<div class="igBar"><span id="lhtml-48"><a href="#" onclick="javascript:showCodeTxt('html-48'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-48">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!--模板定义在textarea标签里了--&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textarea</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"template"</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"display:none"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;The Value of x is:<span style="color: #009900;">&lt;%= context.x%<span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/textarea&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!--赋值,上面的&lt;%= context.x%&gt;</span></span>将被替换--&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script&gt;</span></span>document.write(Lyase.View.render({element:&quot;template&quot;}, {x : 10}));<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>如果模板写在单独的文件里:</p>
<div class="igBar"><span id="lhtml-49"><a href="#" onclick="javascript:showCodeTxt('html-49'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-49">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script&gt;</span></span>document.write(Lyase.View.render({file:&quot;tmp.tpl&quot;}, {x : 10}));<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>模板tmp.tpl的内容为:</p>
<div class="igBar"><span id="lhtml-50"><a href="#" onclick="javascript:showCodeTxt('html-50'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-50">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">The value of x is:<span style="color: #009900;">&lt;%= context.x%<span style="color: #000000; font-weight: bold;">&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>甚至还可以支持复杂的循环:</p>
<div class="igBar"><span id="lhtml-51"><a href="#" onclick="javascript:showCodeTxt('html-51'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-51">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textarea</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"template"</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"display:none"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;">&lt;% context.list.each<span style="color: #66cc66;">&#40;</span>function<span style="color: #66cc66;">&#40;</span>pair<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>%<span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; The value of <span style="color: #009900;">&lt;%= pair.<span style="color: #000066;">name</span> %<span style="color: #000000; font-weight: bold;">&gt;</span></span> is: <span style="color: #009900;">&lt;%= pair.value%<span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;">&lt;% <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span> %<span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/textarea&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="ljavascript-52"><a href="#" onclick="javascript:showCodeTxt('javascript-52'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-52">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">//code</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span>Lyase.<span style="color: #006600;">View</span>.<span style="color: #006600;">render</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>element:<span style="color: #3366CC;">"template"</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span>list :<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#123;</span><span style="color: #000066;">name</span> : <span style="color: #3366CC;">"x"</span>, value : <span style="color: #CC0000;color:#800000;">10</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span><span style="color: #000066;">name</span> : <span style="color: #3366CC;">"y"</span>, value : <span style="color: #CC0000;color:#800000;">20</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>很可惜的是,我测试的时候,这东东只能utf-8环境下跑的很好,gb2312会被显示为乱码,估计是Prototype的ajax在post的时候出现的问题</p>
<p>更多的例子看这里:<br />
<a href="http://inforno.net/articles/2006/02/15/the-embed-javascript-implementation">http://inforno.net/articles/2006/02/15/the-embed-javascript-implementation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/164/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>用ajax+json连接yahoo搜索web service打造本地搜索引擎</title>
		<link>http://www.ooso.net/archives/160</link>
		<comments>http://www.ooso.net/archives/160#comments</comments>
		<pubDate>Tue, 07 Mar 2006 09:18:39 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/160</guid>
		<description><![CDATA[今天写了一个demo,利用yahoo提供的Yahoo! UI Library调用search web service,实现本地搜索.下面是代码片断说明:
调用Yahoo! UI Library Connection Manager的必要代码:
PLAIN TEXT
JAVASCRIPT:

				<span class="readmore"><a href="http://www.ooso.net/archives/160" title="用ajax+json连接yahoo搜索web service打造本地搜索引擎">阅读全文（1830字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>今天写了一个demo,利用yahoo提供的<a href="http://developer.yahoo.net/yui/index.html" target="_blank">Yahoo! UI Library</a>调用search web service,实现本地搜索.下面是代码片断说明:</p>
<p>调用Yahoo! UI Library Connection Manager的必要代码:</p>
<div class="igBar"><span id="ljavascript-58"><a href="#" onclick="javascript:showCodeTxt('javascript-58'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-58">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!-- <span style="color: #003366; font-weight: bold;">Namespace</span> source file --&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script src = <span style="color: #3366CC;">"js/YAHOO.js"</span>&gt;&lt;/script&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!-- Connection Manager source file --&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script src = <span style="color: #3366CC;">"js/connection.js"</span>&gt;&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>查询表单</p>
<div class="igBar"><span id="lhtml-59"><a href="#" onclick="javascript:showCodeTxt('html-59'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-59">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"form1"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"form1"</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">""</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; 关键字</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; :</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"query"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"query"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"photo"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"button"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Submit"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"搜索"</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">"searchIt(document.getElementById('query').value)"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<span id="more-160"></span></p>
<p>yahoo提供的的web service,可以直接以json的格式返回数据,也支持xml格式,这里采用json</p>
<div class="igBar"><span id="ljavascript-60"><a href="#" onclick="javascript:showCodeTxt('javascript-60'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-60">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color: #3366CC;">"text/javascript"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">//yahoo提供的的web service</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> searchUrl = <span style="color: #3366CC;">'http://api.search.yahoo.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&amp;results=4&amp;output=json&amp;query='</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> resultWin = document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'result'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> responseSuccess = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>o<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">//调用成功后执行的函数</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #009900; font-style: italic;">//transaction success case logic</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #000066; font-weight: bold;">eval</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'var rs ='</span> + o.<span style="color: #006600;">responseText</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #003366; font-weight: bold;">var</span> tmp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #003366; font-weight: bold;">var</span> j = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #009900; font-style: italic;">//这里以js格式化数据内容</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #003366; font-weight: bold;">var</span> content = <span style="color: #3366CC;">'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #3366CC;">&lt;ul&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #000066; font-weight: bold;">for</span><span style="color: #66cc66;">&#40;</span>i <span style="color: #000066; font-weight: bold;">in</span> rs.<span style="color: #006600;">ResultSet</span>.<span style="color: #006600;">Result</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; tmp = rs.<span style="color: #006600;">ResultSet</span>.<span style="color: #006600;">Result</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; content+= <span style="color: #3366CC;">'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #3366CC;">&lt;li class=&quot;cols&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;'</span> + tmp.<span style="color: #006600;">ClickUrl</span> + <span style="color: #3366CC;">'&quot;&gt;&lt;img src=&quot;'</span> + tmp.<span style="color: #006600;">Thumbnail</span>.<span style="color: #006600;">Url</span> + <span style="color: #3366CC;">'&quot; width=&quot;60&quot; border=&quot;0&quot; alt=&quot;'</span> + tmp.<span style="color: #006600;">Title</span> + <span style="color: #3366CC;">'&quot;/&gt;&lt;/a&gt;&lt;/li&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #3366CC;">'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>j == <span style="color: #CC0000;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;j = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;content+= <span style="color: #3366CC;">'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #3366CC;">&lt;div class=&quot;rows&quot;&gt;&lt;/div&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #3366CC;">'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;j++;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;content+= <span style="color: #3366CC;">'&lt;/ul&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #3366CC;">'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;resultWin.<span style="color: #006600;">innerHTML</span> = content;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'debug'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">innerText</span> = o.<span style="color: #006600;">responseText</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">//callback定义,见&lt;a href=&quot;http://developer.yahoo.net/yui/connection/index.html&quot;&gt;http://developer.yahoo.net/yui/connection/index.html&lt;/a&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> callback =</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;success:responseSuccess</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">//查询</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> searchIt<span style="color: #66cc66;">&#40;</span>query<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>!query<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">return</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;resultWin.<span style="color: #006600;">innerHTML</span> = <span style="color: #3366CC;">'查找ing.....</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #3366CC;">&lt;img src=&quot;images/searching.gif&quot;/&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;YAHOO.<span style="color: #006600;">util</span>.<span style="color: #006600;">Connect</span>.<span style="color: #006600;">asyncRequest</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'POST'</span>, searchUrl + query, callback, <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>最开始使用了上面的代码片段,在本机能够成功调用yahoo的web service,但是经常报跨站警报,相当不便.<br />
于是采用代理模式,写了个很简单的proxy.php,如下:</p>
<div class="igBar"><span id="lphp-61"><a href="#" onclick="javascript:showCodeTxt('php-61'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-61">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$searchUrl</span> = <span style="color:#FF0000;">'http://api.search.yahoo.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&amp;results=4&amp;output=json&amp;query='</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span>!<span style="color:#000066;">empty</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'query'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#000066;">echo</span> <span style="color:#000066;">file_get_contents</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$searchUrl</span> . <span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'query'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>而js部分只要做个小小调整</p>
<div class="igBar"><span id="ljavascript-62"><a href="#" onclick="javascript:showCodeTxt('javascript-62'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-62">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> searchUrl = <span style="color: #3366CC;">'proxy.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">..................................</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">//查询</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> searchIt<span style="color: #66cc66;">&#40;</span>query<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>!query<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">return</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;resultWin.<span style="color: #006600;">innerHTML</span> = <span style="color: #3366CC;">'查找ing.....</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #3366CC;">&lt;img src=&quot;images/searching.gif&quot;/&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;YAHOO.<span style="color: #006600;">util</span>.<span style="color: #006600;">Connect</span>.<span style="color: #006600;">asyncRequest</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'POST'</span>, searchUrl, callback, <span style="color: #3366CC;">'query='</span> + query<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
最后就以这段简单的代码实现了本地搜索,你可以在此demo的基础上进一步完善,例如翻页,调整每页显示的数目等等,具体参数请参考<a href="http://developer.yahoo.net/search/local/V3/localSearch.html">http://developer.yahoo.net/search/local/V3/localSearch.html</a></p>
<p>解压密码:www.ooso.net<br />
<a href="http://www.ooso.net/cache/search.rar" target="_blank">demo下载</a></p>
<p>参考文档:<br />
<a href="http://developer.yahoo.net/yui/connection/index.html">http://developer.yahoo.net/yui/connection/index.html</a><br />
<a href="http://developer.yahoo.net/php/howto-parseRestPhp.html">http://developer.yahoo.net/php/howto-parseRestPhp.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/160/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Rasmus Lerdorf: 无框架式的PHP MVC 框架</title>
		<link>http://www.ooso.net/archives/153</link>
		<comments>http://www.ooso.net/archives/153#comments</comments>
		<pubDate>Thu, 02 Mar 2006 04:04:23 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[json]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/153</guid>
		<description><![CDATA[Rasmus Lerdorf  在他的blog上发表了一篇文章no-framework PHP MVC framework,这篇文章的例子是一个简单的web应用,使用sqlite和pdo做为数据库应用层,用ajax和json做为数据校验,view层使用了一些Yahoo! User Interface Library.的组件,全部例子完全由PHP+HTML+JAVASCRIPT组成,没有使用第三方的Framework.
 注:这篇文章的主题只是提出如何使用php本身构建mvc的web应用,并不讨论面向过程还是面向对象两种编程方式哪种更好.
]]></description>
			<content:encoded><![CDATA[<p>Rasmus Lerdorf  在他的blog上发表了一篇文章<a href="http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html" target="_blank">no-framework PHP MVC framework</a>,这篇文章的例子是一个简单的web应用,使用sqlite和pdo做为数据库应用层,用ajax和json做为数据校验,view层使用了一些<a href="http://loadaveragezero.com/app/s9y/index.php?/archives/90-Yahoo!-User-Interface-Library.html" target="_blank">Yahoo! User Interface Library.</a>的组件,全部例子完全由PHP+HTML+JAVASCRIPT组成,没有使用第三方的Framework.</p>
<p> 注:这篇文章的主题只是提出如何使用php本身构建mvc的web应用,并不讨论面向过程还是面向对象两种编程方式哪种更好.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/153/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpmore vol6 发布</title>
		<link>http://www.ooso.net/archives/149</link>
		<comments>http://www.ooso.net/archives/149#comments</comments>
		<pubDate>Tue, 14 Feb 2006 00:37:41 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/149</guid>
		<description><![CDATA[什么是Web 2.0
prototype.js开发笔记
Tips：用prototype写Ajax网站
构建跨浏览器的XML+XPath数据岛应用

				<span class="readmore"><a href="http://www.ooso.net/archives/149" title="phpmore vol6 发布">阅读全文（161字）</a></span>]]></description>
			<content:encoded><![CDATA[<p><img hspace="8" src="http://v2.phpmore.com/img/moreicon.jpg" align="left" vspace="8" /></p>
<li>什么是Web 2.0</li>
<li>prototype.js开发笔记</li>
<li>Tips：用prototype写Ajax网站</li>
<li>构建跨浏览器的XML+XPath数据岛应用</li>
<li>如何创建Rss2.0文档</li>
<li>小巧灵活的AJAX开发库-SACK</li>
<li>Ajax in CakePHP</li>
<li>轻轻松松做拖动</li>
<li><a href="http://v2.phpmore.com/mag.php" target="_blank"><font color="#ff0000">点击下载《PHP&#038;MORE》电子杂志第六期。</font></a> 投稿信箱<a href="mailto:EasyChen@Gmail.com"><font color="#ff0000">EasyChen@Gmail.com</font></a></li>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/149/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
