<?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>RockFu.Net - Rock my life! &#187; Code</title>
	<atom:link href="http://www.rockfu.net/blog/category/website/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rockfu.net/blog</link>
	<description>讓生活多一點浪漫</description>
	<lastBuildDate>Fri, 27 Jan 2012 04:02:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>wordpress 自定rss 內容</title>
		<link>http://www.rockfu.net/blog/2011/05/website/code/wordpress-diy-rss-feed/</link>
		<comments>http://www.rockfu.net/blog/2011/05/website/code/wordpress-diy-rss-feed/#comments</comments>
		<pubDate>Thu, 19 May 2011 15:09:08 +0000</pubDate>
		<dc:creator>rockfu</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false">http://www.rockfu.net/blog/?p=2802</guid>
		<description><![CDATA[<br/>wordprss 可以選擇訂閱內容全部顯示或部分顯示，假如部分顯示，也許有些東西在底部推薦給讀者的看不到，這裡有個方法，在function 裡面加上一段 if ( !function_exists(&#039;custom_feed_footer&#039;) ){        function custom_feed_footer($content)         {                if(is_feed())                $content .= &#039;自定內容&#039;;              &#8230; <a href="http://www.rockfu.net/blog/2011/05/website/code/wordpress-diy-rss-feed/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<br/><p>wordprss 可以選擇訂閱內容全部顯示或部分顯示，假如部分顯示，也許有些東西在底部推薦給讀者的看不到，這裡有個方法，在function 裡面加上一段</p>
<pre class="brush: php">

if ( !function_exists(&#039;custom_feed_footer&#039;) ){        function custom_feed_footer($content)         {                if(is_feed())                $content .= &#039;自定內容&#039;;                return $content;        }        add_filter(&#039;the_excerpt_rss&#039;, &#039;custom_feed_footer&#039;);        add_filter(&#039;the_content&#039;, &#039;custom_feed_footer&#039;);}
</pre>
<p>記錄一下，希望有用</p>
<p>來自：<a href="http://www.wordpress.la/custom-feed-bottom-content.html">http://www.wordpress.la/custom-feed-bottom-content.html</a></p>
<div style="text-align:center;width:100%;"><div style="margin:0px 0px 0px 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-5237544886808594";
/* 300x250, 已建立 2009/2/20 */
google_ad_slot = "8308848689";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div><img src="http://www.rockfu.net/blog/?ak_action=api_record_view&id=2802&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.rockfu.net/blog/2011/05/website/code/wordpress-diy-rss-feed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>wordpress attachment images</title>
		<link>http://www.rockfu.net/blog/2011/05/website/code/wordpress-attachment-images/</link>
		<comments>http://www.rockfu.net/blog/2011/05/website/code/wordpress-attachment-images/#comments</comments>
		<pubDate>Sat, 07 May 2011 03:14:16 +0000</pubDate>
		<dc:creator>rockfu</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.rockfu.net/blog/?p=2787</guid>
		<description><![CDATA[<br/>最近做主題時要用到wordpress 附件圖片，在看數據庫時發現，原來每一個附件都是作為一個post插入數據庫，只是post-type不同，而且還有是屬於哪個post。在文章中也可以直接插入gallery。 看到這些功能，心動了，只是這些自帶的功能缺乏的東西就是附件圖片的描述。 根據說明，取得附件的function 是wp_get_attachment_image($id,size)，這樣加一個foreach就能取得到post裡面的所有附件圖片，不過就是缺少介紹。 用google找到了一篇不錯的文件，寫了一個hack，可以取得附件圖片的title, description /** * Retrieves the attachment data such as Title, Caption, Alt Text, Description * @param int $post_id the ID of the Post, Page, or Custom Post Type * @param String $size The desired &#8230; <a href="http://www.rockfu.net/blog/2011/05/website/code/wordpress-attachment-images/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<br/><p>最近做主題時要用到wordpress 附件圖片，在看數據庫時發現，原來每一個附件都是作為一個post插入數據庫，只是post-type不同，而且還有是屬於哪個post。在文章中也可以直接插入gallery。</p>
<p>看到這些功能，心動了，只是這些自帶的功能缺乏的東西就是附件圖片的描述。</p>
<p>根據說明，取得附件的function 是wp_get_attachment_image($id,size)，這樣加一個foreach就能取得到post裡面的所有附件圖片，不過就是缺少介紹。</p>
<p>用google找到了一篇不錯的文件，寫了一個hack，可以取得附件圖片的title, description</p>
<pre class="brush: php">
/**
* Retrieves the attachment data such as Title, Caption, Alt Text, Description
* @param int $post_id the ID of the Post, Page, or Custom Post Type
* @param String $size The desired image size, e.g. thumbnail, medium, large, full, or a custom size
* @return stdClass If there is only one result, this method returns a generic
* stdClass object representing each of the image&#039;s properties, and an array if otherwise.
*/
function getImageAttachmentData( $post_id, $size = &#039;thumbnail&#039;, $count = 1 )
{
$objMeta = array();
$meta;// (stdClass)
$args = array(
&#039;numberposts&#039; =$count,
&#039;post_parent&#039; =$post_id,
&#039;post_type&#039; = &#039;attachment&#039;,
&#039;nopaging&#039; =false,
&#039;post_mime_type&#039; =&#039;image&#039;,
&#039;order&#039; = &#039;ASC&#039;, // change this to reverse the order
&#039;orderby&#039; = &#039;menu_order ID&#039;, // select which type of sorting
&#039;post_status&#039; = &#039;any&#039;
);

$attachments = get_children($args);

if( $attachments )
{
foreach( $attachments as $attachment )
{
$meta = new stdClass();
$meta-ID = $attachment-ID;
$meta-title = $attachment-post_title;
$meta-caption = $attachment-post_excerpt;
$meta-description = $attachment-post_content;
$meta-alt = get_post_meta($attachment-ID, &#039;_wp_attachment_image_alt&#039;, true);

// Image properties
$props = wp_get_attachment_image_src( $attachment-ID, $size, false );

$meta-properties[&#039;url&#039;] = $props[0];
$meta-properties[&#039;width&#039;] = $props[1];
$meta-properties[&#039;height&#039;] = $props[2];

$objMeta[] = $meta;
}

return ( count( $attachments ) == 1 ) ? $meta : $objMeta;
}
}
</pre>
<p>如何使用：</p>
<pre class="brush: php">
getImageAttachmentData( $_posts-ID, &#039;full&#039; );
</pre>
<p>參考來源：<a href="http://www.farfromfearless.com/">http://www.farfromfearless.com/</a></p>
<p><a href="http://www.newvibes.com/blog/wordpress-get-attachment-title-and-description/">http://www.newvibes.com/blog/wordpress-get-attachment-title-and-description/</a></p>
<img src="http://www.rockfu.net/blog/?ak_action=api_record_view&id=2787&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.rockfu.net/blog/2011/05/website/code/wordpress-attachment-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Php NCR 轉換</title>
		<link>http://www.rockfu.net/blog/2011/03/website/code/php-ncr-%e8%bd%89%e6%8f%9b/</link>
		<comments>http://www.rockfu.net/blog/2011/03/website/code/php-ncr-%e8%bd%89%e6%8f%9b/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 04:24:28 +0000</pubDate>
		<dc:creator>rockfu</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.rockfu.net/blog/2011/03/website/code/php-ncr-%e8%bd%89%e6%8f%9b/</guid>
		<description><![CDATA[<br/>將BIG5-HKSCS 轉unicode 符號可以解決好多香港特殊字體問題。 NCR 其實就是一堆符號，舉例， &#38;#39321;&#38;#28207; = 香港 如何將這些進行轉換，php 裡面有函數可以轉換 // convert UTF-8 string to NCR mb_convert_encoding($utf8_str, &#8216;HTML-ENTITIES&#8217;, &#8216;utf-8&#8242;);   // convert NCR back to UTF-8 mb_convert_encoding($ncr_str, &#8216;utf-8&#8242;, &#8216;HTML-ENTITIES&#8217;);   不過要注意的是，確保所以字再轉換前已經是同一種編碼，因為有些字是簡體，繁體裡沒有，可能就會出現問題，最好再輸入後，先把所有字轉成utf8，再進行轉換，可以確保不同編碼問題]]></description>
			<content:encoded><![CDATA[<br/><p>將BIG5-HKSCS 轉unicode 符號可以解決好多香港特殊字體問題。
</p>
<p>NCR 其實就是一堆符號，舉例，
</p>
<p>&amp;#39321;&amp;#28207;  = 香港
</p>
<p>如何將這些進行轉換，php 裡面有函數可以轉換
</p>
<p>// convert UTF-8 string to NCR
</p>
<p>mb_convert_encoding($utf8_str, &#8216;HTML-ENTITIES&#8217;, &#8216;utf-8&#8242;);
</p>
<p>
 </p>
<p>// convert NCR back to UTF-8
</p>
<p>mb_convert_encoding($ncr_str, &#8216;utf-8&#8242;, &#8216;HTML-ENTITIES&#8217;);
</p>
<p>
 </p>
<p>不過要注意的是，確保所以字再轉換前已經是同一種編碼，因為有些字是簡體，繁體裡沒有，可能就會出現問題，最好再輸入後，先把所有字轉成utf8，再進行轉換，可以確保不同編碼問題</p>
<img src="http://www.rockfu.net/blog/?ak_action=api_record_view&id=2770&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.rockfu.net/blog/2011/03/website/code/php-ncr-%e8%bd%89%e6%8f%9b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>網頁自動轉跳3個方法</title>
		<link>http://www.rockfu.net/blog/2010/02/website/code/3-way-to-auto-switch-website/</link>
		<comments>http://www.rockfu.net/blog/2010/02/website/code/3-way-to-auto-switch-website/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 11:26:09 +0000</pubDate>
		<dc:creator>rockfu</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[網頁轉跳]]></category>

		<guid isPermaLink="false">http://www.rockfu.net/blog/?p=2400</guid>
		<description><![CDATA[<br/>紀錄一下常用的3種網頁自動轉跳方法，例如rockfu.net 也是用自動轉跳到rockfu.net/blog，雖然我也不想用文件裝著，不過有時候對搜尋器有點用處，但有些又說不好，不夠直接，不過還是算了，放下資料夾下方便管理還是正確的。介紹幾種方法，包含javascript，meta，flash 第一種，javascript 網頁自動轉跳： &#60;script language=javascript&#62; function nextpage(){ location="http://www.rockfu.net/blog" } nextpage() &#60;/script&#62; 第二種，meta 網頁自動轉跳： &#60;meta http-equiv=&#8221;refresh&#8221; content=&#8221;0.1;url=http://www.rockfu&#8221;&#62; 這種更加簡單，在head中添加一個格式如下： 解釋下，10 代表10秒，yoururl一樣替代為你的網址，很容易喔。 第三種，flash 網頁自動轉跳，也就是製作一個swf文件在網頁上播，播完就跳，這裡介紹as3 的navigateToURL var url:String = "yoururl"; var request:URLRequest = new URLRequest (url); try{ navigateToURL(request, "_self"); } catch (e:Error) { &#8230; <a href="http://www.rockfu.net/blog/2010/02/website/code/3-way-to-auto-switch-website/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<br/><p>紀錄一下常用的3種網頁自動轉跳方法，例如rockfu.net 也是用自動轉跳到rockfu.net/blog，雖然我也不想用文件裝著，不過有時候對搜尋器有點用處，但有些又說不好，不夠直接，不過還是算了，放下資料夾下方便管理還是正確的。介紹幾種方法，包含javascript，meta，flash</p>
<p>第一種，javascript 網頁自動轉跳：</p>
<pre>&lt;script language=javascript&gt; 

function nextpage(){
location="http://www.rockfu.net/blog"
}
nextpage() 

&lt;/script&gt;</pre>
<p>第二種，meta 網頁自動轉跳：</p>
<p>&lt;meta http-equiv=&#8221;refresh&#8221; content=&#8221;0.1;url=http://www.rockfu&#8221;&gt;</p>
<p>這種更加簡單，在head中添加一個格式如下：</p>
<p>解釋下，10 代表10秒，yoururl一樣替代為你的網址，很容易喔。 第三種，flash 網頁自動轉跳，也就是製作一個swf文件在網頁上播，播完就跳，這裡介紹as3 的navigateToURL</p>
<pre lang="actionscript">var url:String = "yoururl";
var request:URLRequest = new URLRequest (url);
try{
 navigateToURL(request, "_self");
} catch (e:Error) {

 trace("Error occurred!");

 }</pre>
<p>yoururl換成網址，記得要http，在navigateToURL，_self是開啓網頁方式，_self是本身那網頁，新窗口用_blank就可以。</p>
<p>第三種</p>
<p>三種方式，紀錄下來，以後不用找來找去</p>
<img src="http://www.rockfu.net/blog/?ak_action=api_record_view&id=2400&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.rockfu.net/blog/2010/02/website/code/3-way-to-auto-switch-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php photo uploader</title>
		<link>http://www.rockfu.net/blog/2010/01/website/code/php-photo-uploader/</link>
		<comments>http://www.rockfu.net/blog/2010/01/website/code/php-photo-uploader/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 16:24:29 +0000</pubDate>
		<dc:creator>rockfu</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.rockfu.net/blog/?p=2187</guid>
		<description><![CDATA[<br/>最近kav 和silau都正忙著他們的photo uploader，昨晚無聊間試著尋找php 的class ，包括一些 upload, check link, ftp 之類，無意之間見到一個界面和速度都不錯的相片上在系統 Chevereto，界面簡單，功能不錯，可以更改相片大小，也可以生成簡短的link，更可以輸入連結來下載更改圖片大小，同時都會出到code 給你引用到其他頁面，簡單的一頁卻包含不同的功能，真是不簡單。最神奇的是其支援PHP FTP功能，即是說可以用其他空間來擺放這些上載的圖片，那用外國那些聲稱無限空間的網存計劃來做FTP不是很不錯？ 我也下載來試下，目前只是給自己用：http://imfreeman.com/uploader/，不用軟件就可以縮放圖片，很方便，適合懶人XD。我只是拿來學習用，至於能不能發揮，看你自己啦。 下載鏈接：http://chevereto.com/]]></description>
			<content:encoded><![CDATA[<br/><p>最近kav 和silau都正忙著他們的photo uploader，昨晚無聊間試著尋找php 的class ，包括一些 upload, check link, ftp 之類，無意之間見到一個界面和速度都不錯的相片上在系統 Chevereto，界面簡單，功能不錯，可以更改相片大小，也可以生成簡短的link，更可以輸入連結來下載更改圖片大小，同時都會出到code 給你引用到其他頁面，簡單的一頁卻包含不同的功能，真是不簡單。最神奇的是其支援PHP FTP功能，即是說可以用其他空間來擺放這些上載的圖片，那用外國那些聲稱無限空間的網存計劃來做FTP不是很不錯？</p>
<p><img class="alignnone" title="php photo upload script" src="http://imfreeman.com/uploader/uploadimages/phpuploader.jpg" alt="" width="500" height="280" /></p>
<p>我也下載來試下，目前只是給自己用：<a href="http://imfreeman.com/uploader/">http://imfreeman.com/uploader/</a>，不用軟件就可以縮放圖片，很方便，適合懶人XD。我只是拿來學習用，至於能不能發揮，看你自己啦。</p>
<p>下載鏈接：<a href="http://chevereto.com/">http://chevereto.com/</a></p>
<img src="http://www.rockfu.net/blog/?ak_action=api_record_view&id=2187&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.rockfu.net/blog/2010/01/website/code/php-photo-uploader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

