<?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>IM.ASHI &#187; 头像</title>
	<atom:link href="http://ashi.im/article/tag/%e5%a4%b4%e5%83%8f/feed" rel="self" type="application/rss+xml" />
	<link>http://ashi.im</link>
	<description>有的时候做自己,有的时候却不得不放弃自己。</description>
	<lastBuildDate>Mon, 24 May 2010 00:55:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>折腾一下-带头像显示的最新评论代码</title>
		<link>http://ashi.im/article/touxiang-pinglun.html</link>
		<comments>http://ashi.im/article/touxiang-pinglun.html#comments</comments>
		<pubDate>Tue, 19 Jan 2010 03:23:15 +0000</pubDate>
		<dc:creator>阿士</dc:creator>
				<category><![CDATA[代码如诗]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[头像]]></category>
		<category><![CDATA[缓存]]></category>
		<category><![CDATA[评论]]></category>

		<guid isPermaLink="false">http://ashi.im/article/touxiang-pinglun.html</guid>
		<description><![CDATA[&#160;
&#160;
<a href="http://ashi.im/article/touxiang-pinglun.html" target="_self"><img align="left" alt="" border="0" class="thickbox" height="142" src="http://ashi.im/wp-content/uploads/dandy-pink.png" width="161" /></a>博客不折腾不行啊，用现在这个主题的时候本来想弄个头像缓存来着，不过在使用代码的时候发现问题了，不能用的。
<strong>zwwooooo</strong>写过一篇关于<a href="http://zww.me/archives/24711" target="_blank">willin的头像缓存</a>的文章，对willin大师的代码进行推广应用，里面提到我现在用的这个Elegant Box主题的修改，阿士上次用的时候发现博客出现问题，于是就作罢。这两天发现不弄不行啊，博客载入超慢，今天本想找Z大问问，不过代码清除......<p class='alignright'><a href='http://ashi.im/article/touxiang-pinglun.html'>阅读全文</a></p>]]></description>
			<content:encoded><![CDATA[<div id="yass_top_edge_dummy" style="border-width: 0px; margin: -9px 0px 0px; padding: 0px; width: 1px; height: 1px; display: block;">&nbsp;</div>
<div id="yass_top_edge" style="border-width: 0px; margin: 0px 0px 0px -8px; padding: 0px; background-image: url(chrome://yass/content/edgebgtop.png); background-attachment: scroll; background-position: center bottom; height: 0px; display: block; width: 1px;">&nbsp;</div>
<p style="margin-top: 20px;"><a href="http://ashi.im/article/touxiang-pinglun.html" target="_self"><img align="left" alt="" border="0" class="thickbox" height="142" src="http://ashi.im/wp-content/uploads/dandy-pink.png" width="161" /></a>博客不折腾不行啊，用现在这个主题的时候本来想弄个头像缓存来着，不过在使用代码的时候发现问题了，不能用的。</p>
<p><strong>zwwooooo</strong>写过一篇关于<a href="http://zww.me/archives/24711" target="_blank">willin的头像缓存</a>的文章，对willin大师的代码进行推广应用，里面提到我现在用的这个Elegant Box主题的修改，阿士上次用的时候发现博客出现问题，于是就作罢。这两天发现不弄不行啊，博客载入超慢，今天本想找Z大问问，不过代码清除格式后发现没出现问题&#8230;汗，还好，不要麻烦人家了。</p>
<p>这第一步完成了，那么就折腾下侧边栏的最新评论了，之前用的代码没有带头像显示，后来换成有带头像显示的了，不过没有头像缓存。既然Z大那里又这个代码，那么就学学吧，CP党，囧~</p>
<blockquote><pre><span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;h2&gt;</span><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">Recent Comments</span></span><span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;/h2&gt;</span>
<span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;ul</span> <span style="color: rgb(255, 0, 0);">class=</span><span style="color: rgb(0, 0, 255);">&quot;recentcomments&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;</span>
<span style="color: rgb(0, 128, 128);">&lt;?php</span>
<span style="color: rgb(0, 0, 128); font-weight: bold;">global</span> <span style="color: rgb(0, 0, 0);">$wpdb</span>;
<span style="color: rgb(0, 0, 0);">$sql</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 255);">&quot;SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url,comment_author_email, SUBSTRING(comment_content,1,18) AS com_excerpt FROM</span> <span style="color: rgb(0, 0, 255);">$wpdb-&gt;comments</span> <span style="color: rgb(0, 0, 255);">LEFT OUTER JOIN</span> <span style="color: rgb(0, 0, 255);">$wpdb-&gt;posts</span> <span style="color: rgb(0, 0, 255);">ON (</span><span style="color: rgb(0, 0, 255);">$wpdb-&gt;comments</span><span style="color: rgb(0, 0, 255);">.comment_post_ID =</span> <span style="color: rgb(0, 0, 255);">$wpdb-&gt;posts</span><span style="color: rgb(0, 0, 255);">.ID) WHERE comment_approved = &#39;1&#39; AND comment_type = &#39;&#39; AND comment_author != &#39;zwwooooo&#39; AND post_password = &#39;&#39; ORDER BY comment_date_gmt DESC LIMIT 10&quot;</span>;
<span style="color: rgb(0, 0, 0);">$comments</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">$wpdb</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(255, 0, 0);">get_results</span>(<span style="color: rgb(0, 0, 0);">$sql</span>);
<span style="color: rgb(0, 0, 128); font-weight: bold;">foreach</span> (<span style="color: rgb(0, 0, 0);">$comments</span> <span style="color: rgb(0, 0, 128); font-weight: bold;">as</span> <span style="color: rgb(0, 0, 0);">$comment</span>) <span style="color: rgb(0, 0, 0);">{</span>
<span style="color: rgb(0, 0, 0);">$output</span> <span style="color: rgb(0, 0, 0);">.=</span> <span style="color: rgb(0, 0, 255);">&quot;</span><span style="color: rgb(0, 0, 255);">\n</span><span style="color: rgb(0, 0, 255);">&lt;li&gt;&quot;.<span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">get_avatar</span>(<span style="color: rgb(0, 0, 0);">get_comment_author_email</span>(<span style="color: rgb(0, 0, 255);">&#39;comment_author_email&#39;</span><span style="color: rgb(0, 0, 0);">),</span> <span style="color: rgb(0, 0, 255);">32</span>)</span><span style="color: rgb(0, 0, 0);">.&quot;</span></span><span style="color: rgb(0, 0, 255);">&lt;a href=</span><span style="color: rgb(0, 0, 255);">\&quot;</span><span style="color: rgb(0, 0, 255);">&quot;</span> <span style="color: rgb(0, 0, 0);">.</span> <span style="color: rgb(0, 0, 0);">get_permalink</span>(<span style="color: rgb(0, 0, 0);">$comment</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(255, 0, 0);">ID</span>) <span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 255);">&quot;#comment-&quot;</span> <span style="color: rgb(0, 0, 0);">.</span> <span style="color: rgb(0, 0, 0);">$comment</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(255, 0, 0);">comment_ID</span> <span style="color: rgb(0, 0, 0);">.</span> <span style="color: rgb(0, 0, 255);">&quot;</span><span style="color: rgb(0, 0, 255);">\&quot;</span> <span style="color: rgb(0, 0, 255);">title=</span><span style="color: rgb(0, 0, 255);">\&quot;</span><span style="color: rgb(0, 0, 255);">on &quot;</span> <span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">$comment</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(255, 0, 0);">post_title</span> <span style="color: rgb(0, 0, 0);">.</span> <span style="color: rgb(0, 0, 255);">&quot;</span><span style="color: rgb(0, 0, 255);">\&quot;</span><span style="color: rgb(0, 0, 255);">&gt;&quot;</span> <span style="color: rgb(0, 0, 0);">.</span> <span style="color: rgb(0, 0, 0);">strip_tags</span>(<span style="color: rgb(0, 0, 0);">$comment</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(255, 0, 0);">com_excerpt</span>)<span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 255);">&quot;&lt;/a&gt;...&lt;/li&gt;&quot;</span>;
<span style="color: rgb(0, 0, 0);">}</span>
<span style="color: rgb(0, 0, 0);">$output</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">convert_smilies</span>(<span style="color: rgb(0, 0, 0);">$output</span>);
<span style="color: rgb(0, 0, 128); font-weight: bold;">echo</span> <span style="color: rgb(0, 0, 0);">$output</span>;
<span style="color: rgb(0, 128, 128);">?&gt;</span>
<span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;/ul&gt;
</span></pre>
</blockquote>
<p>这个是使用了willin的头像缓存后才能用的代码，至于没有缓存的代码，请移步。<a href="http://zww.me/archives/24736" target="_blank"><span style="background-color: rgb(178, 34, 34);">传送阵</span></a></p>
<blockquote>
<p><strong>说明：</strong></p>
<ul>
<li><strong>comment_date_gmt DESC LIMIT 10</strong> 中的 10 是指要显示的评论个数</li>
<li><strong>SUBSTRING(comment_content,1,18)</strong> 中的 18 是指每条评论的中文文字个数</li>
<li>头像的图片大小自行在style.css增加个名为&ldquo;recentcomments&rdquo;的 class 定义（例如width:32px; height:32px;）</li>
<li><strong>zwwooooo</strong> 改为你自己的用户名（就是不显示自己的评论）</li>
<li>参数 $a 是缓存路径</li>
</ul>
</blockquote>
<p>等等，今天要说明的就是这里了。这么一句：</p>
<blockquote>
<p><strong>zwwooooo</strong> 改为你自己的用户名（就是不显示自己的评论）</p>
</blockquote>
<p>我把他改为&quot;阿士&quot;，结果不行的，不知道是不是由于是中文的原因，改成我的登录用户名貌似也不行。没办法，有问题了，去Google一下，发现有人这样写的。</p>
<blockquote>
<p>AND user_id=&#39;0&#39;</p>
</blockquote>
<p>嘿嘿，搞定了，不知道什么原因，我的ID也不是0来着，反正能用就行了。所以把上面的：</p>
<blockquote><pre>AND comment_author != &#39;zwwooooo&#39;</pre>
</blockquote>
<p>改改就OK了。</p>
<h2  class="related_post_title">你可以看看相关的东东:</h2><ul class="related_post"><li><a href="http://ashi.im/article/original_size_image-js.html" title="浏览器可显示原图片的JS">浏览器可显示原图片的JS</a> (36)<br /><small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在逛Opera...</small></li><li><a href="http://ashi.im/article/wordpress-thumb.html" title="给你的wordpress文章添加缩略图">给你的wordpress文章添加缩略图</a> (31)<br /><small>&nbsp;
&nbsp;
创建日志缩略图我想很多wper都有用过这个方法，很多主题都自带这个功...</small></li><li><a href="http://ashi.im/article/asppacktools.html" title="ASP打包解包工具代码(xml)">ASP打包解包工具代码(xml)</a> (1)<br /><small>网站备份通常是整站备份比较好，通过空间商的备份还是不太保险啊。原始人事件大家都知道，那么要如何备份呢...</small></li><li><a href="http://ashi.im/article/effectscode.html" title="网页特效代码">网页特效代码</a> (0)<br /><small>把你的鼠标滑过来看看
...</small></li><li><a href="http://ashi.im/article/iecachedraw.html" title="IE缓存文件提取器">IE缓存文件提取器</a> (0)<br /><small>软件名称：IE缓存文件提取器(本人花钱下载的，现在免费提供给大家)
软件大小：838KB
软件简介：...</small></li><li><a href="http://ashi.im/article/asprollcode.html" title="ASP滚动代码">ASP滚动代码</a> (1)<br /><small>  我要滚动  

[html]
我要滚动 $Link_Code$
 



[/html]

78...</small></li><li><a href="http://ashi.im/article/digg.html" title="【PJ修改】digg功能（基于jquery)">【PJ修改】digg功能（基于jquery)</a> (0)<br /><small>打开：Template\static.htm 、 Template\Article.asp
找到：
...</small></li></ul>]]></content:encoded>
			<wfw:commentRss>http://ashi.im/article/touxiang-pinglun.html/feed</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
	</channel>
</rss>
