<?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; plugins</title>
	<atom:link href="http://mifunny.info/category/wp/plugins-wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://mifunny.info</link>
	<description>走走停停看看，恍然大悟。</description>
	<lastBuildDate>Sun, 18 Jul 2010 08:55:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>按照自己的方式，去度过人生!</title>
		<link>http://mifunny.info/a-life-just-for-me-324.html</link>
		<comments>http://mifunny.info/a-life-just-for-me-324.html#comments</comments>
		<pubDate>Thu, 28 Jan 2010 13:08:08 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[Google热榜]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Study notes]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[かわいい玩具]]></category>
		<category><![CDATA[一半动漫]]></category>
		<category><![CDATA[听听音乐]]></category>
		<category><![CDATA[吹水唬滥]]></category>
		<category><![CDATA[大佛Linux]]></category>
		<category><![CDATA[就评电影]]></category>
		<category><![CDATA[心情札记]]></category>
		<category><![CDATA[时事快评]]></category>
		<category><![CDATA[本民经济]]></category>
		<category><![CDATA[此间Web]]></category>
		<category><![CDATA[漫谈人物]]></category>
		<category><![CDATA[版本控制]]></category>
		<category><![CDATA[疮痍广告]]></category>
		<category><![CDATA[百度风云榜]]></category>
		<category><![CDATA[设计模式]]></category>
		<category><![CDATA[读书时间]]></category>
		<category><![CDATA[软件笑谈]]></category>
		<category><![CDATA[那些技术]]></category>
		<category><![CDATA[人生]]></category>

		<guid isPermaLink="false">http://mifunny.info/a-life-just-for-me-324.html</guid>
		<description><![CDATA[昨晚11点, 第三次读完《明朝那些事儿》, 彻夜未眠. LD 并不是个聪明的人, 前两次均未理解所谓历史 所谓宿命 所谓自由. 这半年, 从09年9月, 第三次读《明》, 完全不同的感受, 石悅的历史观也许是悲观的, 正如他如是说. 然, LD 是悲愤的! 可以活得唯唯缩缩, 可以轰轰烈烈, 也可平平淡淡, 人之所以为人, 就是与别个不同. 10月, LD 曾慕名前往于谦祠, 旁边帅GG 惊呼: 于谦? 谁啊? 好像以前学过&#8230; 是啊~ 我也是. 强人只是那么一瞬间, 那一刻 绽放比凡人璀璨的花火, 之后殒灭为尘秽, 清澈、汙浊平凡无异. 生活的目标 一点足矣, 开心. 礼义廉耻 忠义孝廉 儿戏 儿戏, 二十几年来, 从没有这么坚定, 从没有这么澄净. 引用《火鳳燎原》中那句话: 属于我的这个年代, 将比任何朝代来得久远!]]></description>
			<content:encoded><![CDATA[<p>昨晚11点, 第三次读完《明朝那些事儿》, 彻夜未眠. </p>
<p>LD 并不是个聪明的人, 前两次均未理解所谓历史 所谓宿命 所谓自由. 这半年, 从09年9月, 第三次读《明》, 完全不同的感受, 石悅的历史观也许是悲观的, 正如他如是说. 然, LD 是悲愤的! </p>
<p>可以活得唯唯缩缩, 可以轰轰烈烈, 也可平平淡淡, 人之所以为人, 就是与别个不同. 10月, LD 曾慕名前往于谦祠, 旁边帅GG 惊呼: 于谦? 谁啊? 好像以前学过&#8230;  是啊~ 我也是. 强人只是那么一瞬间, 那一刻 绽放比凡人璀璨的花火, 之后殒灭为尘秽, 清澈、汙浊平凡无异.</p>
<p>生活的目标 一点足矣, 开心. 礼义廉耻 忠义孝廉 儿戏 儿戏, 二十几年来, 从没有这么坚定, 从没有这么澄净. 引用《火鳳燎原》中那句话: 属于我的这个年代, 将比任何朝代来得久远!</p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/a-life-just-for-me-324.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>自己写的 WordPress 淘客插件</title>
		<link>http://mifunny.info/wp-plugin-taoke-250.html</link>
		<comments>http://mifunny.info/wp-plugin-taoke-250.html#comments</comments>
		<pubDate>Wed, 18 Mar 2009 06:27:43 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[插件.自定义字段]]></category>
		<category><![CDATA[淘客]]></category>

		<guid isPermaLink="false">http://mifunny.info/wp-plugin-taoke-250.html</guid>
		<description><![CDATA[LD前几天心血来潮写的这个插件，很简单，主要是一行正则表达式。 这个Wordpress淘客插件主要功能就是把发布在文字文章中的淘客代码分解成： taoke_table（图形形式全部table代码）、 taoke_url 推广链接、taoke_image 宝贝图片、taoke_title 标题文字、taoke_price 商品价格。这五个字段将自动写入对应日志的 &#8220;自定义字段&#8221;中， 方便修改WP皮肤时调用！ 和其他插件安装相同，解压文件至 wp-content/plugins/ 目录，在WP后台启动即可。 下载地址： wp-tao.tar.bz2 http://nothing-at-all.googlecode.com/files/wp-tao.tar.bz2 下面是效果演示，至于自定义字段怎么调用，请Google一下！]]></description>
			<content:encoded><![CDATA[<p style="text-indent: 2em;"><a rel="bookmark" title="水草树 博主" href="http://mifunny.info/">LD</a>前几天心血来潮写的这个插件，很简单，主要是一行正则表达式。 这个Wordpress淘客插件主要功能就是把发布在文字文章中的淘客代码分解成： taoke_table（图形形式全部table代码）、 taoke_url 推广链接、taoke_image 宝贝图片、taoke_title 标题文字、taoke_price 商品价格。这五个字段将自动写入对应日志的 &#8220;自定义字段&#8221;中， 方便修改WP皮肤时调用！</p>
<p style="text-indent: 2em;">和其他插件安装相同，解压文件至 wp-content/plugins/ 目录，在WP后台启动即可。</p>
<p><span id="more-250"></span>下载地址： <strong>wp-tao.tar.bz2</strong> <br />
<a rel="external" href="http://nothing-at-all.googlecode.com/files/wp-tao.tar.bz2">http://nothing-at-all.googlecode.com/files/wp-tao.tar.bz2</a></p>
<p style="text-indent: 2em;">下面是效果演示，至于自定义字段怎么调用，请Google一下！</p>
<div class="wp-caption aligncenter" style="width: 410px"><a href="http://lh6.ggpht.com/_Th1ctZq-HFA/ScCRE4FuBkI/AAAAAAAABno/NhsCipcpNwk/s800/01-wp-taoke.png"><img title="复制右边的图形形式淘客推广HTML代码至文章中（点击观看大图）" src="http://lh6.ggpht.com/_Th1ctZq-HFA/ScCRE4FuBkI/AAAAAAAABno/NhsCipcpNwk/s400/01-wp-taoke.png" alt="复制右边的图形形式淘客推广HTML代码至文章中" width="400" height="168" /></a><p class="wp-caption-text">复制右边的图形形式淘客推广HTML代码至文章中（点击观看大图）</p></div>
<div class="wp-caption aligncenter" style="width: 410px"><a href="http://lh6.ggpht.com/_Th1ctZq-HFA/ScCRFOdRPEI/AAAAAAAABnw/7IyY8LWzJRU/s800/02-wp-taoke.png"><img title="保存或更新文章后，写入自定义字段中（点击观看大图）" src="http://lh6.ggpht.com/_Th1ctZq-HFA/ScCRFOdRPEI/AAAAAAAABnw/7IyY8LWzJRU/s400/02-wp-taoke.png" alt="保存或更新文章后，写入自定义字段中" width="400" height="335" /></a><p class="wp-caption-text">保存或更新文章后，写入自定义字段中（点击观看大图）</p></div>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/wp-plugin-taoke-250.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>WordPress Related Posts插件中几个很有用的函数</title>
		<link>http://mifunny.info/several-very-useful-function-in-wordpress-related-posts-plugin-224.html</link>
		<comments>http://mifunny.info/several-very-useful-function-in-wordpress-related-posts-plugin-224.html#comments</comments>
		<pubDate>Wed, 04 Feb 2009 05:39:16 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[plugins]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Related]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[函数]]></category>
		<category><![CDATA[相关文章]]></category>
		<category><![CDATA[评论最多的文章]]></category>
		<category><![CDATA[随机文章]]></category>

		<guid isPermaLink="false">http://mifunny.info/several-very-useful-function-in-wordpress-related-posts-plugin-224.html</guid>
		<description><![CDATA[WordPress Related Posts是用来获得相关文章的WP插件。然而其中也有几个很有用的函数，比如：热门文章和随机文章。 1.相关文章 wp_related_posts(); 2.随机文章 wp_random_posts(5); // 5表示显示5篇日志，随便改&#8230; 3.评论最多的文章 wp_most_commented_posts(7); // 7表示显示7篇日志，随便改&#8230; 第一个函数会显示 &#60;ul&#62; &#60;li&#62; 标题1 &#60;/li&#62;&#60;li&#62; 标题2 &#60;/li&#62;…… &#60;/ul&#62;的形式， 后两个函数返回 &#60;li&#62; 标题1 &#60;/li&#62;&#60;li&#62; 标题2 &#60;/li&#62;…… ; 使用时别忘加上 ul 标签。]]></description>
			<content:encoded><![CDATA[<p style="text-indent: 2em;"><a rel="external" href="http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/">WordPress Related Posts</a>是用来获得相关文章的WP插件。然而其中也有几个很有用的函数，比如：热门文章和随机文章。</p>
<p>1.相关文章</p>
<blockquote><p>wp_related_posts(); </p></blockquote>
<p>2.随机文章</p>
<blockquote><p> wp_random_posts(5);  // 5表示显示5篇日志，随便改&#8230;</p></blockquote>
<p>3.评论最多的文章</p>
<blockquote><p>wp_most_commented_posts(7);  // 7表示显示7篇日志，随便改&#8230;</p></blockquote>
<p><span id="more-224"></span>第一个函数会显示 <span style="color:blue;">&lt;ul&gt; &lt;li&gt; 标题1 &lt;/li&gt;&lt;li&gt; 标题2 &lt;/li&gt;…… &lt;/ul&gt;</span>的形式， 后两个函数返回 <span style="color:blue;">&lt;li&gt; 标题1 &lt;/li&gt;&lt;li&gt; 标题2 &lt;/li&gt;……</span> ; 使用时别忘加上 ul 标签。</p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/several-very-useful-function-in-wordpress-related-posts-plugin-224.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>WordPress自动采集插件：FwArtsAutoIn</title>
		<link>http://mifunny.info/fwartsautoin-automatic-collection-plugin-for-wodpress-219.html</link>
		<comments>http://mifunny.info/fwartsautoin-automatic-collection-plugin-for-wodpress-219.html#comments</comments>
		<pubDate>Thu, 29 Jan 2009 02:50:58 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[采集]]></category>
		<category><![CDATA[风度采集]]></category>

		<guid isPermaLink="false">http://mifunny.info/?p=219</guid>
		<description><![CDATA[经济不景气，所以想做个垃圾站赚点外快，所以找了一下自动采集的工具。没想到连Wordpress也有这样的插件 &#8211; 风度采集插件 虽然只是RSS采集，但是作者oyster说加入了不少SEO的东西，LD没有只看了一下，功能弱了点，但其中那随机插入链接的选项着实不错！ 最后要说的做网赚的朋友，在利用博客进行SEO时，可以使用该插件进行长时间的文章更新， 作者主页如是说： 本插件采集的文章对搜索引擎很友好,我自己的测试采集站mylove,mylife 就是很牛B的 上线16天来到目前为止 GOOGLE,SOUGOU,均收录400条,百度收录160条 风度采集插件主页地址： http://www.flywud.com/fwauotoin/]]></description>
			<content:encoded><![CDATA[<p>经济不景气，所以想做个垃圾站赚点外快，所以找了一下自动采集的工具。没想到连Wordpress也有这样的插件 &#8211;  <a href="http://www.flywud.com/fwauotoin/">风度采集插件</a></p>
<p>虽然只是RSS采集，但是作者oyster说加入了不少SEO的东西，LD没有只看了一下，功能弱了点，但其中那随机插入链接的选项着实不错！<br />
<span id="more-219"></span></p>
<div class="wp-caption aligncenter" style="width: 410px"><img title="Wordpress风度采集插件界面" src="http://lh3.ggpht.com/_Th1ctZq-HFA/SYEXICGhDUI/AAAAAAAABWs/zaVGpkHvw7w/s400/help2.png" alt="Wordpress风度采集插件界面" width="400" height="263" /><p class="wp-caption-text">Wordpress风度采集插件界面</p></div>
<p>最后要说的做网赚的朋友，在利用博客进行SEO时，可以使用该插件进行长时间的文章更新， 作者主页如是说： <span style="color:blue">本插件采集的文章对搜索引擎很友好,我自己的测试采集站mylove,mylife 就是很牛B的 上线16天来到目前为止 GOOGLE,SOUGOU,均收录400条,百度收录160条</span></p>
<p>风度采集插件主页地址：<a href="http://www.flywud.com/fwauotoin/"> http://www.flywud.com/fwauotoin/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/fwartsautoin-automatic-collection-plugin-for-wodpress-219.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>WordPress插件: 长尾巴(Long Tail)</title>
		<link>http://mifunny.info/long-tail-120.html</link>
		<comments>http://mifunny.info/long-tail-120.html#comments</comments>
		<pubDate>Thu, 02 Oct 2008 06:03:58 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[plugins]]></category>
		<category><![CDATA[tail]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[尾巴]]></category>

		<guid isPermaLink="false">http://mifunny.info/long-tail-120.html</guid>
		<description><![CDATA[使用WordPress玩博客时总会碰到这样的情况: 遇到好的Web服务，需要修改&#60;head&#62;标签（比如: OpenID、FeedM8）, 或是在&#60;/body&#62;标签前加入一些js代码（比如: Google Analytics）。 这些操作都需修改主题文件，如果你只是需要试用一下，岂不是很麻烦？ 闲来无事，写了个插件 ── 长尾巴(Long Tail)，可以在&#60;head&#62;和&#60;body&#62;尾部添加自定义的信息。 下载地址： long_tail.0.3.zip _ _ long_tail.0.2.zip _ 解压到worpress插件目录后，在后台启用， 于Options(设置) -> Long Tail(长尾巴) 填入你的信息， 使用Update Options按钮更新设置即可。 提示：本插件需要WP主题符合一些规范 =&#62; 主题文件 header.php 中的标签&#60;/head&#62;前必须要有 &#60;?php wp_head(); ?&#62; 函数; 主题文件 footer.php 中的标签&#60;/body&#62;前必须要有 &#60;?php wp_footer(); ?&#62; 函数; 插件将会在上面两处输出; _ 另一个需注意0.3版可以直接在后台插入php代码, 必须包含在 &#60;?php ?&#62; 中， 比如： &#60;?php echo &#8220;Long Tail.&#8221;; ?&#62;]]></description>
			<content:encoded><![CDATA[<p style="text-indent: 2em" >使用WordPress玩博客时总会碰到这样的情况: 遇到好的Web服务，需要修改<span style="color:#1E90FF;">&lt;head&gt;</span>标签（比如: OpenID、FeedM8）, 或是在<span style="color:#1E90FF;">&lt;/body&gt;</span>标签前加入一些js代码（比如: <a href="http://mifunny.info/google-analytics-19.html" target="_bank" title="Google统计服务"  alt="Google Analytics 统计">Google Analytics</a>）。 这些操作都需修改主题文件，如果你只是需要试用一下，岂不是很麻烦？ 闲来无事，写了个插件 ── 长尾巴(Long Tail)，可以在<span style="color:#1E90FF;">&lt;head&gt;</span>和<span style="color:#1E90FF;">&lt;body&gt;</span>尾部添加自定义的信息。</p>
<p>下载地址： <a href="http://nothing-at-all.googlecode.com/files/tail.0.3.zip" target="_bank" title="wordpress插件: 长尾巴(Long Tail) 0.3" alt="wordpress 插件 长尾巴 Long Tail 0.3" >long_tail.0.3.zip </a> _  _  <a href="http://nothing-at-all.googlecode.com/files/long_tail.zip" target="_bank" title="wordpress插件: 长尾巴(Long Tail)" alt="wordpress 插件 长尾巴 Long Tail" >long_tail.0.2.zip</a> _</p>
<p style="text-indent: 2em" >解压到worpress插件目录后，在后台启用， 于Options(设置) -> Long Tail(长尾巴) 填入你的信息， 使用Update Options按钮更新设置即可。 </p>
<p><span id="more-120"></span><span style="color:red;">提示：</span>本插件需要WP主题符合一些规范 =&gt;
<ol style="list-style-type: decimal">
<li>主题文件 header.php 中的标签<span style="color:#1E90FF;">&lt;/head&gt;</span>前必须要有 &lt;?php <span style="color:#A020F0;">wp_head();</span> ?&gt; 函数;</li>
<li>主题文件 footer.php 中的标签<span style="color:#1E90FF;">&lt;/body&gt;</span>前必须要有 &lt;?php <span style="color:#A020F0;">wp_footer();</span> ?&gt; 函数;</li>
</ol>
<p>插件将会在上面两处输出;  _ 另一个需<span style="color:red;">注意</span>0.3版可以直接在后台插入php代码, 必须包含在 <span style="color:#1E90FF;">&lt;?php</span>  <span style="color:#1E90FF;">?&gt;</span> 中， 比如： <span style="color:#1E90FF;">&lt;?php</span> <span style="color:#11AB11;">echo</span> <span style="color:#FFA500;">&#8220;Long Tail.&#8221;;</span>  <span style="color:#1E90FF;">?&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/long-tail-120.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>自定义个性&#8221;唐诗宋词&#8221;模块</title>
		<link>http://mifunny.info/make-own-module-for-chinese-poem-96.html</link>
		<comments>http://mifunny.info/make-own-module-for-chinese-poem-96.html#comments</comments>
		<pubDate>Sat, 30 Aug 2008 12:27:15 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[plugins]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[唐诗]]></category>
		<category><![CDATA[宋词]]></category>
		<category><![CDATA[模块]]></category>

		<guid isPermaLink="false">http://mifunny.info/make-own-module-for-chinese-poem-96.html</guid>
		<description><![CDATA[通过本文你将学到 自定义&#8221;唐诗宋词&#8221;模块来实现： 每日一句拽言牛语; 随机显示一条名言警句，并安置在Blog首页的浏览器标题栏; 随机显示图片(小心，可能是我的忽悠哦); 当我开始写&#8221;唐诗宋词&#8220;之前根本没有想到要输出&#8221;唐诗300 首&#8221;，因为当时在开始接触 设计模式，所以想用PHP写个东西玩玩，当时那些默认模块(唐诗300、宋词100、增广贤文、谚语&#8230;&#8230;)已经被人用shell写成conky的脚本长期定居于我的linux桌面上，那么材料就是它了。实际上这个东西写法类似于设计模式中的策略模式(Strategy), 每加一个模块，只要根据接口重写一个函数即可。最简单的莫过于显示单句了，请看下面这个例子： 1.每日一句拽言牛语 这个和 &#8220;每日一句警言&#8221; 同类，只不过材料不同。网络上有很多拽言牛语，那么要是每天在blog上显示一句，拽就一个字。ok，首先选用 &#8220;2008最新的100句超牛的语言&#8221; 作为原料，按照下面的组识形式写入文件 &#8220;niuyu2008&#8243; ,编码为UTF-8。 再牛b的肖邦，也弹不出老子的悲伤！%我左青龙，右白虎，肩膀纹个米老鼠。%秃驴，敢跟贫道抢师太?% 每一句牛语后换行加一个 &#8220;%&#8221; 号，头可乱格式不能乱！ 至于怎么把这么多句子格式化，随你写脚本、用程序 or 徒手…… whatever. 改好后把 &#8220;niuyu2008&#8243; 移到&#8221;唐诗宋词&#8221;插件的根目录下。使用支持UTF-8的编辑器打开文件 &#8220;poem-models.php&#8221; ，你会发现文件结尾有一段注释: /* Add-Ons 自定义模块 */ 就是这里了，在下面添加代码即可。 class niuyu2008 implements Poem_Inter { public function format_poem($poem_src) { $poem_array = preg_split(&#8216;/\n/&#8217; , $poem_src, -1, PREG_SPLIT_NO_EMPTY); return $poem_array[0]; } //END [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lh5.ggpht.com/kldscs/SLkCW5aMzrI/AAAAAAAAAvw/G5zX-FGIi1g/s400/conky-poem.png"><img class="frame" src="http://lh5.ggpht.com/kldscs/SLkCW5aMzrI/AAAAAAAAAvw/G5zX-FGIi1g/s400/conky-poem.png" align="right" title="请看最下方的'格言妙语'(点击查看大图)"  alt="conky 格言妙语" /></a><br />
通过本文你将学到 自定义&#8221;唐诗宋词&#8221;模块来实现：</p>
<ul style="list-style-type: disc" >
<li><a href="#08niuyu">每日一句拽言牛语</a>;</li>
<li><a href="#wisdom">随机显示一条名言警句</a>，并安置在Blog首页的浏览器标题栏;</li>
<li><a href="#image">随机显示图片</a>(小心，可能是我的忽悠哦);</li>
</ul>
<p style="text-indent: 2em" >当我开始写&#8221;<a href="http://mifunny.info/wp-plugin-chinese-poem-84.html" title="Wordpress插件：唐诗宋词" alt="wordpress 插件 唐诗 宋词" >唐诗宋词</a>&#8220;之前根本没有想到要输出&#8221;唐诗300 首&#8221;，因为当时在开始接触 设计模式，所以想用PHP写个东西玩玩，当时那些默认模块(唐诗300、宋词100、增广贤文、谚语&#8230;&#8230;)已经被人用shell写成conky的脚本长期定居于我的linux桌面上，那么材料就是它了。实际上这个东西写法类似于设计模式中的<i>策略模式(Strategy)</i>, 每加一个模块，只要根据接口重写一个函数即可。最简单的莫过于显示单句了，请看下面这个例子：</p>
<p><span id="more-96"></span><br />
<strong>1.<a name="08niuyu">每日一句拽言牛语</a></strong></p>
<p style="text-indent: 2em" >这个和 &#8220;每日一句警言&#8221; 同类，只不过材料不同。网络上有很多拽言牛语，那么要是每天在blog上显示一句，拽就一个字。ok，首先选用 &#8220;2008最新的100句超牛的语言&#8221; 作为原料，按照下面的组识形式写入文件 &#8220;niuyu2008&#8243; ,编码为UTF-8。<br />
<table style="border:2px solid #E0E0E0;" >
<tbody>
<tr>
<td>再牛b的肖邦，也弹不出老子的悲伤！<br />%<br />我左青龙，右白虎，肩膀纹个米老鼠。<br />%<br />秃驴，敢跟贫道抢师太?<br />%</td>
</tr>
</tbody>
</table>
<p>每一句牛语后换行加一个 &#8220;%&#8221; 号，头可乱格式不能乱！ 至于怎么把这么多句子格式化，随你写脚本、用程序 or 徒手…… whatever.</p>
<p style="text-indent: 2em" >改好后把 &#8220;niuyu2008&#8243; 移到&#8221;唐诗宋词&#8221;插件的根目录下。使用支持UTF-8的编辑器打开文件 &#8220;poem-models.php&#8221; ，你会发现文件结尾有一段注释: /* Add-Ons  自定义模块 */ 就是这里了，在下面添加代码即可。</p>
<p><coolcode lang="php" ><br />
class niuyu2008 implements Poem_Inter {<br />
	public function format_poem($poem_src) {<br />
		$poem_array = preg_split(&#8216;/\n/&#8217; , $poem_src, -1, PREG_SPLIT_NO_EMPTY);<br />
		return $poem_array[0];<br />
	} //END func format_poem<br />
} //END class niuyu2008<br />
</coolcode><br />
保存后在你blog皮肤中需要显示的地方插入：<br />
<coolcode lang="php" ><br />
< ?php<br />
if (function_exists(show_chinese_poetry))<br />
	show_chinese_poetry(array('niuyu2008'), FALSE, 1440);<br />
?><br />
</coolcode></p>
<p style="text-indent: 2em" >函数 show_chinese_poetry 能根据时间更新（<span sytle="color:red">需要注意的是：</span>使用该函数必须保证插件目录下的 &#8220;poem.tmp&#8221;文件全局可写(权限为666),可以用命令 chmod 666 poem.tmp  来修改，或者FTP工具也可。）， 一天的时间是<span style="color:blue">1440</span>分钟，自己按需要改吧。至于中间的 &#8216;FALSE&#8217;, 是CSS风格参数，为默认模块设计的，自己看poem.css文件吧。 如果是每次刷新换一条牛语，就用 show_chinese_poem ，比 show_chinese_poetry 函数少了时间参数。如果你想在Widget里显示，可以使用0.2版提供的widget配置选项。</p>
<p style="text-indent: 2em" >最后解释一下第一段代码： 每一个模块需要有原料文件（&#8221;niuyu2008&#8243;）、 段处理类（class niuyu2008） 和类中的 文本段处理函数（function format_poem）。 原料文件只要注意格式即可，类名必须和原料文件相同，类需实现 Poem_Inter 接口，重载 format_poem 函数。
</p>
<p style="text-indent: 2em" >最后是 format_poem 函数， 从参数 $poem_src 得到的是一个文本段，如下<br />
<table style="border:2px solid #E0E0E0;" >
<tbody>
<tr>
<td>道，可道，非恒道。<br />名，可名，非恒名。<br />无名，天地之始；<br />有名，万物之母。<br />故常无欲，以观其妙；<br />常有欲，以观其徼。<br />此两者同出而异名，同谓之玄。<br />玄之又玄，众妙之门。<br />　　－－《道德经》<br />%</td>
</tr>
</tbody>
</table>
<p>注意文本段是包含换行符 和 &#8220;%&#8221;的，所以我们要做的就是截取需要的，第一段代码中此函数的第一句就是把文本段分行存入 $poem_array 数组中，然后return 需要的文本（字符串）即可，同时也可处理一下字符串，去除不规范字符什么的。</p>
<p><span style="color:gray;">我不反对用 &#8220;2007年度里最拽最经典的只言片语&#8221; ,但这个文本块不是一行，自己修改一下，或是参考&#8221;默认模块&#8221;。</span></p>
<p>
<strong>2.<a name="wisdom">随机显示一条名言警句，并安置在Blog首页的浏览器标题栏</a></strong></p>
<p style="text-indent: 2em" >前辈<a href="http://yskin.net/">Yskin</a>写过一个WP插件：<a href="http://yskin.net/2006/10/wisdom-title.html">Wisdom Title</a>，可以在在Blog首页的浏览器标题栏随机显示一条名言警句。没错，就是VeryCD首页的效果。 现在我们也来给&#8221;<a href="http://mifunny.info/wp-plugin-chinese-poem-84.html" title="Wordpress插件：唐诗宋词" alt="wordpress 插件 唐诗 宋词" >唐诗宋词</a>&#8220;加一个类似的模块。首先和<a href="#08niuyu">上面</a>相同,搜集一些名言警句，这里先偷个懒，借前辈的劳动成果用一下，把原料按格式保存到插件目录下的 &#8220;wisdom&#8221; 文件中。接着写代码&#8230; 老样子，在 文件 &#8220;poem-models.php&#8221; 最后的注释（/* Add-Ons  自定义模块 */）后面加入：</p>
<p><coolcode lang="php"><br />
/**<br />
 * wisdom:    名言警句<br />
 * 用于blog首页的浏览器标题栏显示<br />
 */<br />
class wisdom implements Poem_Inter {<br />
	/**<br />
	 * @see Poem_Inter::format_poem()<br />
	 *<br />
	 * @param string $poem_src<br />
	 */<br />
	public function format_poem($poem_src) {<br />
		$poem_array = preg_split(&#8216;/\n/&#8217; , $poem_src, -1, PREG_SPLIT_NO_EMPTY);<br />
		$title_add = trim($poem_array[0]);<br />
		$js_code = &#8220;<script type=\"text/javascript\"> document.title = document.title+' - '+'".$title_add."'; </script>&#8220;;<br />
		return $js_code;<br />
	} //END func format_poem<br />
} //END class wisdom<br />
</coolcode><br />
代码完成, 在 WordPress 皮肤的 &#8220;header.php&#8221; 中的标记 &lt;/head&gt; 前加入:<br />
<coolcode lang="php"><br />
< ?php<br />
if (is_home() &#038;&#038; function_exists(show_chinese_poem))<br />
	show_chinese_poem(array('wisdom'), FALSE);<br />
?><br />
</coolcode><br />
<span style="color:red">注意：</span>一定加上 is_home() 这个判断，不然所有的页面浏览器标题都会加上一句警言了哦。 显示的函数选择 show_chinese_poem 。</p>
<p style="text-indent: 2em" >假如很不巧你的博客名字是这样的： &#8220;水草树 &#8211; 大树底下好乘凉&#8221; ,而不是单单的 &#8220;水草树&#8221; ，那么javascript就得换一个版本了。使用正则表达式就可以解决。</p>
<p><coolcode lang="javascript"><br />
<script type="text/javascript">
var patrn = /^.+ - /;
var title =  patrn.exec(document.title)[0];
document.title = title + '".$title_add."'; 
</script><br />
</coolcode></p>
<p>
<strong>3.<a name="image" >随机显示图片</a></strong></p>
<p style="text-indent: 2em" >到这里实在没什么了，如果你明白上面两个例子，就不用说了。因为完成这个功能需要把图片的URL按格式写入文本文件中，谁会这么无聊？ 说我忽悠也行，给出个class了事。</p>
<p><coolcode lang="php"><br />
class image implements Poem_Inter {<br />
	public function format_poem($poem_src) {<br />
		$poem_array = preg_split(&#8216;/\n/&#8217; , $poem_src, -1, PREG_SPLIT_NO_EMPTY);<br />
		return &#8220;<img src=\"".$poem_array[0]."\" \\ />&#8220;;<br />
	} //END func format_poem<br />
} //END class image<br />
</coolcode></p>
<p>本文所用到的原料和添加的代码下载： <a href="http://mifunny.info/blog/uploads/2008/08/modules-addon.zip">modules-addon.zip</a><br />
</p>
<p style="text-indent: 2em; color:gray;" ><b>小结：</b>当时接触设计模式，很好奇，手痒，写了这个东东。 这个插件就到此为止吧，没什么有用的功能，后来的代码也乱了，实在不想说&#8221;小华哥&#8221;经常说的那两个字。</p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/make-own-module-for-chinese-poem-96.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WP插件：唐诗宋词 更新至0.2版，加入widget</title>
		<link>http://mifunny.info/add-widget-to-chinese-poem-93.html</link>
		<comments>http://mifunny.info/add-widget-to-chinese-poem-93.html#comments</comments>
		<pubDate>Fri, 29 Aug 2008 09:02:33 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[plugins]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[唐诗]]></category>
		<category><![CDATA[宋词]]></category>

		<guid isPermaLink="false">http://mifunny.info/add-widget-to-chinese-poem-93.html</guid>
		<description><![CDATA[昨天花了点时间，为&#8221;唐诗宋词&#8221;插件加了个 Widget (效果临时摆在本博客右侧栏的Last.fm挂件下)，配置界面的11个模块一个一个加太麻烦…… 主要更新内容如下： 加入了 show_chinese_poetry 函数，可以控制刷新时间; 为插件写了个Widget; 为widget添加配置界面(截图见文章最后); 实际上2和3就是同一个，不过我无聊，呵呵。 使用说明和下载地址见&#8221;唐诗宋词&#8221;的发布页： WP插件 ─ 唐诗宋词 Widget 配置窗口]]></description>
			<content:encoded><![CDATA[<p style="text-indent: 2em" >昨天花了点时间，为&#8221;唐诗宋词&#8221;插件加了个 Widget (效果临时摆在本博客右侧栏的Last.fm挂件下)，配置界面的11个模块一个一个加太麻烦…… 主要更新内容如下：</p>
<ol style="list-style-type: decimal">
<li>加入了 show_chinese_poetry 函数，可以控制刷新时间;</li>
<li>为插件写了个Widget;</li>
<li>为widget添加配置界面(截图见文章最后);</li>
</ol>
<p>实际上2和3就是同一个，不过我无聊，呵呵。 </p>
<p style="text-indent: 2em" >使用说明和下载地址见&#8221;唐诗宋词&#8221;的发布页： <a href="http://mifunny.info/wp-plugin-chinese-poem-84.html" title="唐诗宋词" alt="唐诗宋词" >WP插件 ─ 唐诗宋词</a></p>
<p><span id="more-93"></span></p>
<p align="center" ><a href="http://lh5.ggpht.com/kldscs/SLeyN8a-JgI/AAAAAAAAAvo/XRU4qw3UXCo/s800/chinese-poem-widget.png" target="_bank" ><img class="frame" src="http://lh5.ggpht.com/kldscs/SLeyN8a-JgI/AAAAAAAAAvo/XRU4qw3UXCo/s400/chinese-poem-widget.png" title="唐诗宋词 配置窗口" alt="唐诗宋词 widget chinese poem" /></a><br />Widget 配置窗口</p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/add-widget-to-chinese-poem-93.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[原创]wordpress插件：唐诗宋词</title>
		<link>http://mifunny.info/wp-plugin-chinese-poem-84.html</link>
		<comments>http://mifunny.info/wp-plugin-chinese-poem-84.html#comments</comments>
		<pubDate>Fri, 22 Aug 2008 15:25:38 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[唐诗]]></category>
		<category><![CDATA[宋词]]></category>

		<guid isPermaLink="false">http://mifunny.info/?p=84</guid>
		<description><![CDATA[就如你所看到的，这个唐诗宋词(chinese poem)插件默认随机显示唐诗300首、宋诗或宋词中的一首。当然了，上面的《出塞》只是图片,真实示例可以查看我的留言板。 === Plugin Name ===唐诗宋词(chinese poem) Contributors: LD KingDonate link: nullTags(有多少写多少，哈哈): tang300,唐诗300首, songproses宋词, song100,宋诗100首, caigentan,菜根谭, dao,道德经, joke,笑话, lunyu,论语, maoshici,毛泽东诗词, maoyulu,毛泽东语录, proverb,谚语, zengguang,增广贤文, poem Requires at least: 2.6Tested up to: 2.6.1Stable tag: 0.2PHP Requires: 5.2.xLicense: GPL v3 == Description ==这个插件允许在Wordpress中随机显示唐诗宋词, 你可以在widget的配置界面选择需要的模块。This plugin show poetry random in WordPress. Downloadchinese-poem.0.3.zipchinese-poem.0.2.zipchinese-poem.0.1.zip 暂时放在Google Code里。也可通过SVN获得： svn checkout http://nothing-at-all.googlecode.com/svn/tags/chinese-poem_0_3svn checkout http://nothing-at-all.googlecode.com/svn/tags/chinese-poem_0_2svn [...]]]></description>
			<content:encoded><![CDATA[<p align="center" ><a href="http://lh5.ggpht.com/kldscs/SK6AqqK0B6I/AAAAAAAAAuo/GUJJS29ONjE/s800/text.png" target="_bank" ><img class="frame" src="http://lh5.ggpht.com/kldscs/SK6AqqK0B6I/AAAAAAAAAuo/GUJJS29ONjE/s800/text.png" title="唐诗300首" alt="王之涣 出塞" /></a></p>
<p style="text-indent: 2em" >就如你所看到的，这个<a href="http://mifunny.info/wp-plugin-chinese-poem-84.html" >唐诗宋词(chinese poem)</a>插件默认随机显示唐诗300首、宋诗或宋词中的一首。当然了，上面的《出塞》只是图片,真实示例可以查看我的<a href="http://mifunny.info/guestbook" target="_bank" title="留言板"  alt="guestbook" >留言板</a>。</p>
<p><span id="more-84"></span><br />
<hr />
<p>=== <b>Plugin Name</b> ===<br />唐诗宋词(chinese poem)</p>
<p>Contributors: LD King<br />Donate link:  null<br />Tags(有多少写多少，哈哈): tang300,唐诗300首, songproses宋词, song100,宋诗100首, caigentan,菜根谭, dao,道德经, joke,笑话, lunyu,论语, maoshici,毛泽东诗词, maoyulu,毛泽东语录, proverb,谚语, zengguang,增广贤文, poem <br />Requires at least: 2.6<br />Tested up to: 2.6.1<br />Stable tag:<span style="color:blue"> 0.2</span><br />PHP Requires: 5.2.x<br />License: <a href="http://www.fsf.org/licensing/licenses/gpl.html" target="_bank" title="GNU General Public License" >GPL v3</a></p>
<p>== <b>Description</b> ==<br />这个插件允许在Wordpress中随机显示唐诗宋词, 你可以在widget的配置界面选择需要的<a href="#modules">模块</a>。<br />This plugin show poetry random in WordPress.</p>
<p><strong>Download</strong><br /><a href="http://nothing-at-all.googlecode.com/files/chinese-poem.0.3.zip" title="唐诗宋词(chinese poem)" alt="chinese poem 0.3" >chinese-poem.0.3.zip</a><br /><a href="http://nothing-at-all.googlecode.com/files/chinese-poem.0.2.zip" title="唐诗宋词(chinese poem)" alt="chinese poem 0.2" >chinese-poem.0.2.zip</a><br /><a href="http://nothing-at-all.googlecode.com/files/chinese-poem.0.1.zip" title="唐诗宋词(chinese poem)" alt="chinese poem 0.1" >chinese-poem.0.1.zip</a><br /> 暂时放在Google Code里。也可通过SVN获得：<br />
<table style="border:2px solid #E0E0E0;" >
<tbody>
<tr>
<td>svn checkout http://nothing-at-all.googlecode.com/svn/tags/chinese-poem_0_3<br />svn checkout http://nothing-at-all.googlecode.com/svn/tags/chinese-poem_0_2<br />svn checkout http://nothing-at-all.googlecode.com/svn/tags/chinese-poem_0_1</td>
</tr>
</tbody>
</table>
<p>第一个是0.3版的Tag，主支在 http://nothing-at-all.googlecode.com/svn/trunk/chinese-poem  </p>
<p><strong>功能说明[Usage]</strong></p>
<p style="text-indent: 2em" >0.2版加入了Widget支持，所以只要启用插件，在Widget界面配置即可。</p>
<p align="center" ><a href="http://lh5.ggpht.com/kldscs/SLeyN8a-JgI/AAAAAAAAAvo/XRU4qw3UXCo/s800/chinese-poem-widget.png" target="_bank" ><img class="frame" src="http://lh5.ggpht.com/kldscs/SLeyN8a-JgI/AAAAAAAAAvo/XRU4qw3UXCo/s400/chinese-poem-widget.png" title="唐诗宋词 配置窗口" alt="唐诗宋词 widget chinese poem" /></a><br />Widget 配置窗口</p>
<p style="text-indent: 2em" >同时0.2还加入了一个可以控制刷新时间的函数 show_chinese_poetry，它比原函数多了个 timespan 参数，<br />
<coolcode lang="php" ><br />
< ?php<br />
if (function_exists(show_chinese_poetry))<br />
	show_chinese_poetry(array('tang300', 'song100', 'songproses'), TRUE, 30);<br />
?><br />
</coolcode><br />
这样就可以每隔30分钟更新一次诗词，<span style="color:red">需要注意的是：</span>使用该函数必须保证插件目录下的 &#8220;poem.tmp&#8221;文件全局可写(权限为666),可以用命令 chmod 666 poem.tmp  来修改，或者FTP工具也可。    <br />详细使用方法可以参考<a href="#onepoem" >函数 show_chinese_poem()</a>。自定义模块也挺简单的，需要的可以参考这篇文章： <a href="http://mifunny.info/make-own-module-for-chinese-poem-96.html" target="_bank" title="自定义 个性 唐诗宋词 模块" alt="自定义 个性 唐诗 宋词 模块" >自定义 个性“唐诗宋词”模块</a>。</p>
<p style="text-indent: 2em" >在<a href="#install">安装完插件</a>后，<a name="onepoem">默认使用以下的代码</a>，将随机从tang300、song100、songproses三个文件中取出一首诗。也就是在我的<a href="http://mifunny.info/guestbook" target="_bank" title="留言板"  alt="guestbook" >留言板</a>中看到的那样，会是唐诗300首、宋诗100首或宋词中的其中之一。</p>
<p><coolcode lang="php" ><br />
< ?php if (function_exists(show_chinese_poem)) show_chinese_poem(); ?><br />
</coolcode></p>
<p align="center" ><img class="frame" src="http://lh5.ggpht.com/kldscs/SK6AquuM7bI/AAAAAAAAAug/jw9mLviZOPc/s800/sidebar.png" title="唐诗300首" alt="杜甫 春望" /><br />放在Sidebar里的唐诗</p>
<p style="text-indent: 2em" >当然，前面的<a href="#modules" >可用模块</a>确实是可以使用的，首先说明一下show_chinese_poem()函数的2个参数：<br />
<coolcode lang="php" ><br />
function show_chinese_poem($modules = array(&#8216;tang300&#8242;, &#8216;song100&#8242;, &#8216;songproses&#8217;), $css = TRUE)<br />
</coolcode><br />
第一个参数$modules 是一维数组，插件会在$modules的模块中自动选择一个作为输出; 而$css是布尔型，TRUE表示加载插件的CSS文件。</p>
<p style="text-indent: 2em" >比如模块中有一个&#8221;毛泽东诗词&#8221;，我希望只在&#8221;毛泽东诗词&#8221;中挑选诗词输出，那么可以这么写：<br />
<coolcode lang="php" ><br />
< ?php<br />
if (function_exists(show_chinese_poem))<br />
	show_chinese_poem(array('maoshici'));<br />
?><br />
</coolcode></p>
<p align="center" ><img class="frame" src="http://lh6.ggpht.com/kldscs/SK6fV0bI0_I/AAAAAAAAAvI/fTbgwgn4dJg/s800/maoshici.png" title="毛泽东诗词" alt="七律 人民解放军占领南京" /></p>
<p style="text-indent: 2em" >此外需要说明的是,输出HTML格式，基本所有模块的输出都和下面的定义差不多,可以据此修改poem.css中的风格。<br />
<coolcode lang="html" ><br />
<span class="poem-title">诗词标题</span><br /><span class="poem-author">诗歌作者</span><br /><span class="poem-content">诗歌内容</span><br />
</coolcode></p>
<p><a name="modules" ><strong>可用模块</strong></a></p>
<ul style="list-style-type: none" >
<li>caigentan:   菜根谭</li>
<li>dao:	     道德经</li>
<li>joke:	     笑话集</li>
<li>lunyu:	     论语</li>
<li>maoshici:    毛泽东诗词</li>
<li>maoyulu:     毛泽东语录</li>
<li>proverb:     谚语</li>
<li>song100:     宋诗100首</li>
<li>songproses:  宋词</li>
<li>tang300:     唐诗300首</li>
<li>zengguang:   增广贤文</li>
</ul>
<p>诗词原始资料来源于<a href="http://code.google.com/p/chinese-fortune/" title="中文fortune" >chinese-fortune</a></p>
<p>== <b><a name="install" >Installation</a></b> ==
<ul style="list-style-type: decimal" >
<li>Upload the Plugin folder to the `/wp-content/plugins/` directory</li>
<li>Activate the plugin through the `Plugins` menu in WordPress</li>
<li>Add Anywhere:  &lt;?php show_chinese_poem() ?&gt;</li>
<li>If you need to configure the CSS style of 唐诗宋词(chinese poem), open and edit: <br />/wp-content/plugins/chinese-poem/poem.css</li>
</ul>
<p><b>后记:</b>
<p style="text-indent: 2em; font-size: 0.9em ; color: gray;" >有一个很有名的开源项目：<a href="http://chinese-fortune.googlecode.com" title="fortune-mode-zh" target="_bank" >fortune-mode-zh</a>，里面有丰富的诗词文件，很早之前，我托ubuntu论坛里大牛的福在一直在conky中使用着。最近在看PHP，干脆写成Wordpress的插件，第一次写插件，还有很多不足，慢慢改吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/wp-plugin-chinese-poem-84.html/feed</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>关于CoolCode在WP系统不在根目录情况下css和js不能加载的bug</title>
		<link>http://mifunny.info/coolcode-bug-54.html</link>
		<comments>http://mifunny.info/coolcode-bug-54.html#comments</comments>
		<pubDate>Thu, 19 Jun 2008 09:45:33 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[plugins]]></category>
		<category><![CDATA[coolcode]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://mifunny.info/coolcode-bug-54.html</guid>
		<description><![CDATA[昨天使用CoolCode插件(Version: 3.4)时才发现： 如果WordPress系统不在根目录，即“WordPress子目录,博客根目录”例如我的http://mifunny.info/,其实上wp的目录在网站根目录下的./blog/; 具体情况可以参考：香草吧噗 ─ WordPress子目录博客根目录; 如上情况的话，就会发现CoolCode的css和js代码不能被加载，看下面的截图： 查看一下coolcode.php ,发现其中加载js和css所用的函数是 get_settings(&#8216;home&#8217;)，看一下wordpress的数据库就会发现，这个函数得到的路径是博客的首页，而不是wordpress的安装目录; 所以这个路径是无效的，只要把他改成 get_option(&#8216;siteurl&#8217;) 就行了，得到的正确的路径。 下面是修改后的效果： 原来的代码 function add_css() { echo &#8216;]]></description>
			<content:encoded><![CDATA[<p style="text-indent: 4mm">昨天使用<a title="andot 的 CoolCode" href="http://www.coolcode.cn/?p=26">CoolCode</a>插件(Version: 3.4)时才发现： 如果WordPress系统不在根目录，即“<strong>WordPress子目录,博客根目录</strong>”例如我的<a title="水草树" href="http://mifunny.info/">http://mifunny.info/</a>,其实上wp的目录在网站根目录下的./blog/; 具体情况可以参考：<a title="WordPress子目录博客根目录" href="http://papu.cn/2007/12/08/giving-wordpress-its-owndirectory.html">香草吧噗 ─ WordPress子目录博客根目录</a>;<br />
如上情况的话，就会发现CoolCode的css和js代码不能被加载，看下面的截图：</p>
<p><img class="frame" title="CoolCode css js 代码未加载" src="http://mifunny.info/blog/uploads/2008/06/coolcode-bug.png" alt="CoolCode css js 代码未加载" /></p>
<p style="text-indent: 4mm">查看一下coolcode.php ,发现其中加载js和css所用的函数是 get_settings(&#8216;home&#8217;)，看一下wordpress的数据库就会发现，这个函数得到的路径是博客的首页，而不是wordpress的安装目录; 所以这个路径是无效的，只要把他改成 get_option(&#8216;siteurl&#8217;) 就行了，得到的正确的路径。 下面是修改后的效果：</p>
<p><span id="more-54"></span><br />
<b>原来的代码</b><br />
<coolcode lang="php"><br />
    function add_css() {<br />
        echo &#8216;
<link rel="stylesheet" href="'<br />
            . get_settings('home')<br />
            . "/wp-content/plugins/coolcode/coolcode.css\" />\n&#8221;;<br />
    }<br />
</coolcode><br />
<br /><b>修改后的代码:</b><br />
<coolcode lang="php"><br />
    function add_css() {<br />
        echo &#8216;
<link rel="stylesheet" href="'<br />
            . get_option('siteurl')<br />
            . "/wp-content/plugins/coolcode/coolcode.css\" />\n&#8221;;<br />
    }<br />
</coolcode></p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/coolcode-bug-54.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>把last.fm嵌入worpress中</title>
		<link>http://mifunny.info/inset-lastfm-into-wordpress-2-29.html</link>
		<comments>http://mifunny.info/inset-lastfm-into-wordpress-2-29.html#comments</comments>
		<pubDate>Tue, 06 May 2008 16:08:37 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[plugins]]></category>
		<category><![CDATA[此间Web]]></category>
		<category><![CDATA[last.fm]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://mifunny.info/inset-lastfm-into-wordpress-2-29.html</guid>
		<description><![CDATA[今天突然收到last.fm的邮件，突然想我开机就到开amarok,听了这么久的歌，last.fm记录超过1万次播放，自己都不觉得，呵呵~ 如果我的blog上能看到我正在听的歌，并且游客还可以试听其中的一些歌，It&#8217;s very cool! Google之后找到了一款wordpress的插件 &#8212; lastfm for wordpress,效果就如下图所示了，仅仅能显示最近播放的歌曲而已。 无聊之际，竟然在last.fm的用户页面看到“将该榜单放到您的网站/博客”的按钮，弹出菜单还有“嵌入wordpress”的选项，不用说了点击进入后按照提示做就ok了，最后会生成内嵌网页的js代码。 生成代码后copy至WP的皮肤中即可，最简单的方法直接放在sidebar.php文件中。 令人郁闷的是，last.fm的音乐品位指数（能找到音乐喜好相同的朋友，和邻居差不多）代码找的的朋友是我自己，还“超级投缘”，是啊~~~做的想的从出生那一刻就没不同过^_^ 这个东西确实不错，但是中文歌不能在线收听，似乎是版权问题。]]></description>
			<content:encoded><![CDATA[<p><!-- inset lastfm into wordpress  --></p>
<p style="text-indent: 4mm" >今天突然收到<a href="http://cn.last.fm/user/kldoo" target="_bank" title="Last.fm" >last.fm</a>的邮件，突然想我开机就到开<a href="http://amarok.kde.org/">amarok</a>,听了这么久的歌，<a href="http://cn.last.fm/user/kldoo" target="_bank" title="Last.fm" >last.fm</a>记录超过1万次播放，自己都不觉得，呵呵~ 如果<a href="http://mifunny.info" target="_bank" title="水草树" >我的blog上</a>能看到我正在听的歌，并且游客还可以试听其中的一些歌，It&#8217;s very cool!
</p>
<table border="0" style="text-indent: 8mm" >
<tr>
<td>
		<a target="_blank"  href="http://cn.last.fm/user/kldoo"><img title="到Last.fm看看" alt="Last.fm"  src="http://lh6.ggpht.com/kldscs/SCBUIZpgAiI/AAAAAAAAAH4/jFVG6HNUwGA/s144/last-fm_audioscrobbler_logo.png" /></a>
	</td>
<td>
		    <a target="_blank"  href="http://amarok.kde.org/"><img title="Amarok是what东东?" alt="Amarok"  src="http://lh5.ggpht.com/kldscs/SCBUIJpgAhI/AAAAAAAAAHw/6y9bY69l4TM/s144/amarok.png" /></a>
	</td>
</tr>
</table>
<p><span id="more-29"></span></p>
<p style="text-indent: 4mm" ><a href="http://www.google.com/" target="_bank" title="谷歌" >Google</a>之后找到了一款wordpress的插件 &#8212; <a href="http://rick.jinlabs.com/code/lastfm/" target="_bank" title="last.fm的wordpress插件" >lastfm for wordpress</a>,效果就如下图所示了，仅仅能显示最近播放的歌曲而已。
</p>
<p style="text-indent: 8mm" >
<a target="_blank" href="http://lh6.ggpht.com/kldscs/SCBSLZpgAfI/AAAAAAAAAHg/j-XbjfNXc1A/s800/2008-05-06-154831_189x343_scrot.png"><img title="点击查看大图" alt="lastfm for wordpress 效果" src="http://lh6.ggpht.com/kldscs/SCBSLZpgAfI/AAAAAAAAAHg/j-XbjfNXc1A/s288/2008-05-06-154831_189x343_scrot.png" /></a>
</p>
<p style="text-indent: 4mm" >无聊之际，竟然在<a href="http://cn.last.fm/user/kldoo" target="_bank" title="我的Last.fm" >last.fm的用户页面</a>看到“将该榜单放到您的网站/博客”的按钮，弹出菜单还有“嵌入wordpress”的选项，不用说了点击进入后按照提示做就ok了，最后会生成内嵌网页的js代码。
</p>
<p style="text-indent: 8mm" >
<a target="_blank" href="http://lh6.ggpht.com/kldscs/SCBSLZpgAgI/AAAAAAAAAHo/HXDyRZ4Ouh0/s800/2008-05-06-160959_563x489_scrot.png"><img title="点击查看大图" alt="嵌入wordpress 按钮" src="http://lh6.ggpht.com/kldscs/SCBSLZpgAgI/AAAAAAAAAHo/HXDyRZ4Ouh0/s288/2008-05-06-160959_563x489_scrot.png" /></a>
</p>
<p style="text-indent: 4mm" >生成代码后copy至WP的皮肤中即可，最简单的方法直接放在<b>sidebar.php</b>文件中。
</p>
<p style="text-indent: 8mm" >
<a target="_blank" href="http://lh6.ggpht.com/kldscs/SCBSLZpgAeI/AAAAAAAAAHY/BUr6TesoQF4/s800/2008-05-06-154804_186x246_scrot.png"><img title="点击查看大图" alt="last.fm 最近收听的曲目" src="http://lh6.ggpht.com/kldscs/SCBSLZpgAeI/AAAAAAAAAHY/BUr6TesoQF4/s288/2008-05-06-154804_186x246_scrot.png" /></a>
</p>
<p style="text-indent: 4mm" >令人郁闷的是，last.fm的音乐品位指数（能找到音乐喜好相同的朋友，和邻居差不多）代码找的的朋友是我自己，还“超级投缘”，是啊~~~做的想的从出生那一刻就没不同过^_^
</p>
<p style="text-indent: 8mm" >
<a target="_blank" href="http://lh5.ggpht.com/kldscs/SCBSLJpgAdI/AAAAAAAAAHQ/AI-S4zmbJhs/s800/2008-05-06-154727_203x345_scrot.png"><img title="点击查看大图" alt="last.fm 音乐品位指数" src="http://lh5.ggpht.com/kldscs/SCBSLJpgAdI/AAAAAAAAAHQ/AI-S4zmbJhs/s288/2008-05-06-154727_203x345_scrot.png" /></a>
</p>
<p style="text-indent: 4mm" >这个东西确实不错，但是中文歌不能在线收听，似乎是版权问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/inset-lastfm-into-wordpress-2-29.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
