<?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>almondlab.</title>
	<atom:link href="http://www.almondlab.jp/feed" rel="self" type="application/rss+xml" />
	<link>http://www.almondlab.jp</link>
	<description>Web Design, Graphic Design, FLASH, CMS</description>
	<lastBuildDate>Sun, 08 Aug 2010 08:23:25 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ThunderbirdにMobileMeのメールアカウントを登録。</title>
		<link>http://www.almondlab.jp/notes/682?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=thunderbird%25e3%2581%25abmobileme%25e3%2581%25ae%25e3%2583%25a1%25e3%2583%25bc%25e3%2583%25ab%25e3%2582%25a2%25e3%2582%25ab%25e3%2582%25a6%25e3%2583%25b3%25e3%2583%2588%25e3%2582%2592%25e7%2599%25bb%25e9%258c%25b2%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/682#comments</comments>
		<pubDate>Sun, 08 Aug 2010 08:23:11 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=682</guid>
		<description><![CDATA[Thumderbirdに登録で、送信がうまくいかなかった際のメモです。]]></description>
			<content:encoded><![CDATA[<p>ThunderbirdにMobileMeのメールアカウントをウィザードに沿って登録したところ、受信は問題なくできているのですが、なぜか送信がうまくいきません。<br />
設定自体は、Apple Mailに登録した情報に合わせてみたつもりですがダメでした。<br />
いろいろ試してみて、SMTPの送信サーバの設定を次のように変更したら、何とか送信ができました。<br />
<img src="http://www.almondlab.jp/wp-content/uploads/thunderbird.png" alt="Thunderbird" class="frame space" /><br />
Apple Mailをメインで使っているので大きな問題はないのですが、送信できないままだと気になってしまって・・・。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/682/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress 3.0にアップグレード。</title>
		<link>http://www.almondlab.jp/notes/676?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=wordpress-3-0%25e3%2581%25ab%25e3%2582%25a2%25e3%2583%2583%25e3%2583%2597%25e3%2582%25b0%25e3%2583%25ac%25e3%2583%25bc%25e3%2583%2589%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/676#comments</comments>
		<pubDate>Wed, 23 Jun 2010 04:17:00 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=676</guid>
		<description><![CDATA[Wordpress 3.0 日本語版が公開されていたので、2.9.2からアップグレードしました。]]></description>
			<content:encoded><![CDATA[<p>WordPress 3.0 日本語版が公開されていたので、2.9.2からアップグレードしました。<br />
アップグレードはデータベース等のバックアップを取ったのちに、管理画面から自動アップグレードにて行いました。<br />
プラグインもいくつか使っていますが、アップグレード後も特に問題なく動作しています。<br />
一般ユーザー向けにはそれほど目立つ新機能はないようですが、テーマ作成における強化、 WordPress MUとの統合はなかなか魅力的です。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/676/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQLコマンドのメモ。</title>
		<link>http://www.almondlab.jp/notes/671?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=mysql%25e3%2582%25b3%25e3%2583%259e%25e3%2583%25b3%25e3%2583%2589%25e3%2581%25ae%25e3%2583%25a1%25e3%2583%25a2%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/671#comments</comments>
		<pubDate>Fri, 18 Jun 2010 06:40:52 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=671</guid>
		<description><![CDATA[ターミナルからMySQLを操作する際のコマンドのメモです。]]></description>
			<content:encoded><![CDATA[<p>ターミナルからMySQLを操作する際のコマンドのメモです。<br />
MySQLはMAMP環境のものを使っています。</p>
<div class="space"></div>
<p>MySQLを実行</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>Applications<span style="color: #000000; font-weight: bold;">/</span>MAMP<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>bin
$ .<span style="color: #000000; font-weight: bold;">/</span>mysql <span style="color: #660033;">-u</span> root <span style="color: #660033;">-p</span></pre></td></tr></table></div>

<div class="space"></div>
<p>全データベースを表示</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">show</span> <span style="color: #990099; font-weight: bold;">databases</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>データベースを作成</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">create</span> <span style="color: #990099; font-weight: bold;">database</span> データベース名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>データベースを削除</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">drop</span> <span style="color: #990099; font-weight: bold;">database</span> データベース名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>データベースを切り替える</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">use</span> データベース名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>全テーブルを表示</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">show</span> <span style="color: #990099; font-weight: bold;">tables</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>テーブルを作成</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">create</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>テーブルを複製</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">create</span> <span style="color: #990099; font-weight: bold;">table</span> 新テーブル名 <span style="color: #CC0099; font-weight: bold;">like</span> テーブル名<span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">insert</span> <span style="color: #990099; font-weight: bold;">into</span> 新テーブル名 <span style="color: #990099; font-weight: bold;">select</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">from</span> テーブル名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>テーブルを削除</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">drop</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>テーブルと同時にフィールドを作成</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">create</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 <span style="color: #FF00FF;">&#40;</span>
id <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">10</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
title <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">50</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
body <span style="color: #999900; font-weight: bold;">text</span>
<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>テーブル名を変更</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">rename</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 <span style="color: #990099; font-weight: bold;">to</span> 新テーブル名<span style="color: #000033;">;</span>
<span style="color: #808000; font-style: italic;">/* または */</span>
<span style="color: #990099; font-weight: bold;">alter</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 <span style="color: #990099; font-weight: bold;">rename</span> <span style="color: #990099; font-weight: bold;">as</span> 新テーブル名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>テーブルの構造を表示</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">show</span> <span style="color: #990099; font-weight: bold;">columns</span> <span style="color: #990099; font-weight: bold;">from</span> テーブル名<span style="color: #000033;">;</span>
<span style="color: #808000; font-style: italic;">/* または */</span>
<span style="color: #990099; font-weight: bold;">desc</span> テーブル名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>フィールドを追加</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">alter</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 <span style="color: #990099; font-weight: bold;">add</span> フィールド名 <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">10</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">alter</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 <span style="color: #990099; font-weight: bold;">add</span> フィールド名 <span style="color: #999900; font-weight: bold;">text</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>フィールドを複数追加</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">alter</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 <span style="color: #990099; font-weight: bold;">add</span> <span style="color: #FF00FF;">&#40;</span>
フィールド名<span style="color: #008080;">1</span> <span style="color: #CC0099;">-&gt;</span> <span style="color: #999900; font-weight: bold;">int</span><span style="color: #000033;">,</span>
フィールド名<span style="color: #008080;">2</span> <span style="color: #CC0099;">-&gt;</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">10</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
フィールド名<span style="color: #008080;">3</span> <span style="color: #CC0099;">-&gt;</span> <span style="color: #999900; font-weight: bold;">text</span>
<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>フィールドを先頭に追加</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">alter</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 <span style="color: #990099; font-weight: bold;">add</span> フィールド名 <span style="color: #999900; font-weight: bold;">text</span> <span style="color: #990099; font-weight: bold;">first</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>フィールドを任意の位置に追加</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">alter</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 <span style="color: #990099; font-weight: bold;">add</span> フィールド名 <span style="color: #999900; font-weight: bold;">text</span> <span style="color: #990099; font-weight: bold;">after</span> 対象フィールド名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>フィールドの順番を入れ替え</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">alter</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 <span style="color: #990099; font-weight: bold;">modify</span> フィールド名 <span style="color: #999900; font-weight: bold;">text</span> <span style="color: #990099; font-weight: bold;">after</span> 対象フィールド名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>フィールド名を変更</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">alter</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 change フィールド名 新フィールド名 <span style="color: #999900; font-weight: bold;">text</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
<p>フィールドを削除</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">alter</span> <span style="color: #990099; font-weight: bold;">table</span> テーブル名 <span style="color: #990099; font-weight: bold;">drop</span> フィールド名<span style="color: #000033;">;</span></pre></td></tr></table></div>

<div class="space"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/671/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>複数のブラウザでのブックマークをXmarksで同期。</title>
		<link>http://www.almondlab.jp/notes/667?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=%25e8%25a4%2587%25e6%2595%25b0%25e3%2581%25ae%25e3%2583%2596%25e3%2583%25a9%25e3%2582%25a6%25e3%2582%25b6%25e3%2581%25a7%25e3%2581%25ae%25e3%2583%2596%25e3%2583%2583%25e3%2582%25af%25e3%2583%259e%25e3%2583%25bc%25e3%2582%25af%25e3%2582%2592xmarks%25e3%2581%25a7%25e5%2590%258c%25e6%259c%259f%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/667#comments</comments>
		<pubDate>Wed, 09 Jun 2010 04:47:33 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=667</guid>
		<description><![CDATA[Safari、Firefox、Chromeなど複数のブラウザで登録しているお気に入り項目を同期します。]]></description>
			<content:encoded><![CDATA[<p>Safari、Firefox、Chromeなど複数のブラウザで登録しているお気に入り項目を「<a href="http://www.xmarks.com/" onclick="window.open(this.href); return false;">Xmarks</a>」というサービスで簡単に同期することができます。<br />
導入方法はXmarksのサイトでアカウントを登録し、各ブラウザごとの機能拡張アプリケーションをインストールします。Safariではシステム機能拡張項目、Firefoxではアドオン、Chromeではエクステンションとブラウザごとに分かれています。<br />
インストールした後は、ウィザードに沿ってブックマークをXmarksのサーバにアップロードして完了です。<br />
ブックマークの同期のほかに、サイトへログインのためのパスワード情報も同期することができます。</p>
<div class="space"></div>
<p><span class="link"><a href="http://www.xmarks.com/" onclick="window.open(this.href); return false;">Xmarks</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/667/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPで西暦を和暦に変換。</title>
		<link>http://www.almondlab.jp/notes/662?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=php%25e3%2581%25a7%25e8%25a5%25bf%25e6%259a%25a6%25e3%2582%2592%25e5%2592%258c%25e6%259a%25a6%25e3%2581%25ab%25e5%25a4%2589%25e6%258f%259b%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/662#comments</comments>
		<pubDate>Wed, 02 Jun 2010 10:12:57 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=662</guid>
		<description><![CDATA[PHPで西暦を和暦の表記に変換するためのコードです。]]></description>
			<content:encoded><![CDATA[<p>PHPで西暦を和暦の表記に変換するためのコードです。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> convert_japanese_year<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2000</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//「H12」を出力</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> convert_japanese_year<span style="color: #009900;">&#40;</span><span style="color: #000088;">$year</span><span style="color: #339933;">,</span> <span style="color: #000088;">$month</span><span style="color: #339933;">,</span> <span style="color: #000088;">$day</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$date</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%04d</span><span style="color: #009933; font-weight: bold;">%02d</span><span style="color: #009933; font-weight: bold;">%02d</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$year</span><span style="color: #339933;">,</span> <span style="color: #000088;">$month</span><span style="color: #339933;">,</span> <span style="color: #000088;">$day</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$date</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">19890108</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//平成元年（1989年1月8日以降）</span>
		<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;H&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$year</span> <span style="color: #339933;">-=</span> <span style="color: #cc66cc;">1988</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$date</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">19261225</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//昭和元年（1926年12月25日以降）</span>
		<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;S&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$year</span> <span style="color: #339933;">-=</span> <span style="color: #cc66cc;">1925</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$date</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">19120730</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//大正元年（1912年7月30日以降）</span>
		<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;T&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$year</span> <span style="color: #339933;">-=</span> <span style="color: #cc66cc;">1911</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$date</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">18680125</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//明治元年（1868年1月25日以降）</span>
		<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;M&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$year</span> <span style="color: #339933;">-=</span> <span style="color: #cc66cc;">1867</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$name</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #000088;">$year</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/662/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codaのブックマーク機能。</title>
		<link>http://www.almondlab.jp/notes/656?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=coda%25e3%2581%25ae%25e3%2583%2596%25e3%2583%2583%25e3%2582%25af%25e3%2583%259e%25e3%2583%25bc%25e3%2582%25af%25e6%25a9%259f%25e8%2583%25bd%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/656#comments</comments>
		<pubDate>Tue, 01 Jun 2010 08:14:48 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[Coda]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=656</guid>
		<description><![CDATA[エディタ編集中に、コード内で頭出しをするためのブックマーク機能。]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.almondlab.jp/wp-content/uploads/coda-bookmark.png" alt="Coda" title="Coda" width="215" height="215" class="right frame" />Codaのちょっとした便利な機能として、ブックマーク機能があります。<br />
編集ウィンドウ左下のコードナビゲーターから、コード中の任意の位置へ頭出しをするためのものです。HTMLのアンカーポイントのような仕組みです。<br />
ブックマークを付けるには、各言語のコメント文の記述で、先頭に「!」を付加することにより、Codaがブックマークとして認識します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- !content --&gt;</span></pre></td></tr></table></div>

<p>詳しくはPanicのサイトに紹介されています。</p>
<div class="space"></div>
<p><span class="link"><a href="http://www.panic.com/coda/developer/quicktip/5.php" onclick="window.open(this.href); return false;">Panic &#8211; Coda &#8211; Developer</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/656/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>オブジェクト、配列の反復処理。</title>
		<link>http://www.almondlab.jp/notes/652?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=%25e3%2582%25aa%25e3%2583%2596%25e3%2582%25b8%25e3%2582%25a7%25e3%2582%25af%25e3%2583%2588%25e3%2580%2581%25e9%2585%258d%25e5%2588%2597%25e3%2581%25ae%25e5%258f%258d%25e5%25be%25a9%25e5%2587%25a6%25e7%2590%2586%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/652#comments</comments>
		<pubDate>Sat, 29 May 2010 02:24:22 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[FLASH]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=652</guid>
		<description><![CDATA[ActionScriptでオブジェクト、または配列の要素を繰り返し処理のメモです。]]></description>
			<content:encoded><![CDATA[<p>ActionScriptでオブジェクト、または配列の要素を繰り返し処理のメモです。<br />
繰り返しの処理にはfor-in文、for each-in文があります。それぞれの違いは生成する要素が、for-in文ではキーを生成して、for each-in文では値を生成します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> object<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Object</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
object<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span> = <span style="color: #990000;">&quot;りんご&quot;</span>;
object<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span> = <span style="color: #990000;">&quot;ばなな&quot;</span>;
object<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;integer&quot;</span><span style="color: #000000;">&#93;</span> = <span style="color: #000000; font-weight:bold;">10</span>;
object<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;array&quot;</span><span style="color: #000000;">&#93;</span> = <span style="color: #0033ff; font-weight: bold;">new</span>  <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;test1&quot;</span>, <span style="color: #990000;">&quot;test2&quot;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #009900;">//キーを生成</span>
<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> key<span style="color: #000000; font-weight: bold;">:*</span> <span style="color: #0033ff; font-weight: bold;">in</span> object<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>key<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #009900;">//値を生成</span>
<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">value</span><span style="color: #000000; font-weight: bold;">:*</span> <span style="color: #0033ff; font-weight: bold;">in</span> object<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>それぞれの出力は次のようになります。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900;">//for-inの場合</span>
<span style="color: #000000; font-weight:bold;">0</span>
<span style="color: #000000; font-weight:bold;">1</span>
array
integer
&nbsp;
<span style="color: #009900;">//for each-inの場合</span>
りんご
ばなな
test1,test2
<span style="color: #000000; font-weight:bold;">10</span></pre></td></tr></table></div>

<p>キーと値の両方を扱いたい場合には、for-in文でキーを生成して、キーから値を呼び出します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> key<span style="color: #000000; font-weight: bold;">:*</span> <span style="color: #0033ff; font-weight: bold;">in</span> object<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>key<span style="color: #000000;">&#41;</span>;
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>object<span style="color: #000000;">&#91;</span>key<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/652/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snippetsでコードを効率よく管理。</title>
		<link>http://www.almondlab.jp/notes/642?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=snippets%25e3%2581%25a7%25e3%2582%25b3%25e3%2583%25bc%25e3%2583%2589%25e3%2582%2592%25e5%258a%25b9%25e7%258e%2587%25e3%2582%2588%25e3%2581%258f%25e7%25ae%25a1%25e7%2590%2586%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/642#comments</comments>
		<pubDate>Tue, 25 May 2010 11:13:12 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Snippet]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=642</guid>
		<description><![CDATA[コードの部品にあたるスニペットを、効率よく管理、再利用するためのアプリケーションです。]]></description>
			<content:encoded><![CDATA[<p>「<a href="http://www.snippetsapp.com/" onclick="window.open(this.href); return false;">Snippets</a>」は一度書いたソースコードを部分的に再利用したい時のため、コードの部品にあたるスニペットを効率よく管理、再利用するためのアプリケーションです。<br />
<img src="http://www.almondlab.jp/wp-content/uploads/snippets-01.png" alt="Snippets" title="Snippets" width="802" height="602" class="space" /><br />
スニペットを呼び出すにはメニューバー上にあるアイコンをクリック、またはグローバルショートカットキーから検索して、使いたいスニペットを選択するとエディタ上にペーストされます。<br />
Snippetsではコードのカラーリングによるハイライト表示ができますが、類似アプリケーションに比べて、比較的多くの言語に対応しています。個人的にはActionScriptも含まれているので嬉しいです。</p>
<div class="space"></div>
<p><span class="link"><a href="http://www.snippetsapp.com/" onclick="window.open(this.href); return false;">Snippets (Lucky Ants)</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/642/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac用のFTPソフト、TransmitとForkLift。</title>
		<link>http://www.almondlab.jp/notes/627?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=mac%25e7%2594%25a8%25e3%2581%25aeftp%25e3%2582%25bd%25e3%2583%2595%25e3%2583%2588%25e3%2580%2581transmit%25e3%2581%25a8forklift%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/627#comments</comments>
		<pubDate>Fri, 21 May 2010 01:27:01 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=627</guid>
		<description><![CDATA[Mac用のFTPソフトTransmitとForkLiftが、ともに新しくなりました。]]></description>
			<content:encoded><![CDATA[<p>Mac用のFTPソフトの代表格TransmitとForkLiftが、ともに最近バージョンアップしました。（ForkLiftのほうは、まだベータ版です）<br />
いずれもインターフェイスに磨きがかかり、使っていて気持ちがよいです。</p>
<div class="space"></div>
<p><img src="http://www.almondlab.jp/wp-content/uploads/transmit-01.png" alt="Transmit" title="Transmit" width="64" height="64" class="left" /></p>
<h3><a href="http://www.panic.com/transmit/" onclick="window.open(this.href); return false;">Transmit 4</a></h3>
<p>Mac用FTPソフトの定番Transmitが4年ぶりにバージョンアップしました。以前から使いやすかったですが、細かいところへの改善が行き届いていて、非常に完成度が高いと思います。</p>
<div class="clear"></div>
<p><img src="http://www.almondlab.jp/wp-content/uploads/transmit-02.png" alt="Transmit" title="Transmit" width="802" height="602" class="space" /><br />
大きな特長は、転送速度の高速化と、サーバを外部ディスクのようにマウントできる機能です。<br />
転送速度の高速化ではファイル数が多い場合に、より速度がアップします。ハイパーターボVTECエンジン搭載で最大25倍速だそうです。<br />
マウント機能もとても便利で、TransmitではなくFinderやその他のソフトからでも直接サーバにアクセスできるようになり、FTPの使い道が広がります。<br />
Transmit 3からのアップグレードは19ドルと、良心的なところも好感が持てます。</p>
<div class="space"></div>
<div class="space"></div>
<p><img src="http://www.almondlab.jp/wp-content/uploads/forklift-01.png" alt="ForkLift" title="ForkLift" width="64" height="64" class="left" /></p>
<h3><a href="http://www.binarynights.com/forklift" onclick="window.open(this.href); return false;">ForkLift 2</a></h3>
<p>ファイルブラウザとしての機能も充実したFTPソフトです。現在はバージョン2のベータ版の状態ですが、新しい機能が多く搭載されています。</p>
<div class="clear"></div>
<p><img src="http://www.almondlab.jp/wp-content/uploads/forklift-02.png" alt="ForkLift" title="ForkLift" width="802" height="602" class="space" /><br />
ForkLiftの場合、Finderにかわるファイルブラウザとしても充分に使えるところが魅力です。新しいバージョンではリスト表示以外にもアイコン、カラム表示が可能になりました。これまでのデュアルパネル、タブに加えて、スタック機能（一時保管する仮想スペース）が追加されて、ファイルのブラウジングは快適です。<br />
その他に圧縮ファイルの解凍や、ファイル名のリネームも機能強化されています。<br />
残念なのは日本語版がないことでしょうか。</p>
<div class="space"></div>
<p><span class="link"><a href="http://www.panic.com/transmit/" onclick="window.open(this.href); return false;">Panic (Transmit)</a></span><br />
<span class="link"><a href="http://www.binarynights.com/forklift" onclick="window.open(this.href); return false;">BinaryNights (ForkLift)</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/627/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>特定の拡張子のリンクファイルのみ別ウィンドウで表示。</title>
		<link>http://www.almondlab.jp/notes/620?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=%25e7%2589%25b9%25e5%25ae%259a%25e3%2581%25ae%25e6%258b%25a1%25e5%25bc%25b5%25e5%25ad%2590%25e3%2581%25ae%25e3%2583%25aa%25e3%2583%25b3%25e3%2582%25af%25e3%2583%2595%25e3%2582%25a1%25e3%2582%25a4%25e3%2583%25ab%25e3%2581%25ae%25e3%2581%25bf%25e5%2588%25a5%25e3%2582%25a6%25e3%2582%25a3%25e3%2583%25b3%25e3%2583%2589%25e3%2582%25a6</link>
		<comments>http://www.almondlab.jp/notes/620#comments</comments>
		<pubDate>Mon, 17 May 2010 15:00:34 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=620</guid>
		<description><![CDATA[リンクを張られたファイルがPDFなどの場合に、別ウィンドウで表示する際のメモです。]]></description>
			<content:encoded><![CDATA[<p>&lt;a&gt;タグでリンクを張られたファイルがPDFなど特定の拡張子を持つ場合に、jQueryを使って別ウィンドウで表示する際のメモです。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a[href$='pdf']&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		window.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>href属性の値が「pdf」で終わる&lt;a&gt;タグ全てに対して、別ウィンドウでの表示に置き換えています。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/620/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IEの動作確認に便利なアプリケーション。</title>
		<link>http://www.almondlab.jp/notes/616?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=ie%25e3%2581%25ae%25e5%258b%2595%25e4%25bd%259c%25e7%25a2%25ba%25e8%25aa%258d%25e3%2581%25ab%25e4%25be%25bf%25e5%2588%25a9%25e3%2581%25aa%25e3%2582%25a2%25e3%2583%2597%25e3%2583%25aa%25e3%2582%25b1%25e3%2583%25bc%25e3%2582%25b7%25e3%2583%25a7%25e3%2583%25b3%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/616#comments</comments>
		<pubDate>Mon, 17 May 2010 01:01:57 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=616</guid>
		<description><![CDATA[Webサイトの制作に便利な、IEの複数バージョンで動作確認するためのアプリケーションいくつかです。]]></description>
			<content:encoded><![CDATA[<p>Webサイト制作の動作確認で、IEはバージョンごとに表示が微妙に変わるので、複数のバージョンで動作確認が必要になります。<br />
そんなときに便利なアプリケーションがいくつかあります。</p>
<div class="space"></div>
<dl>
<dt><a href="http://finalbuilds.edskes.net/iecollection.htm" onclick="window.open(this.href); return false;">Internet Explorer Collection</a></dt>
<dd>バージョン1〜8までのスタンドアローンをまとめてインストールできます。</dd>
<dt><a href="http://tredosoft.com/Multiple_IE" onclick="window.open(this.href); return false;">Multiple IE</a></dt>
<dd>バージョン3〜8までのスタンドアローンをまとめてインストールできます。</dd>
<dt><a href="http://www.my-debugbar.com/wiki/IETester/HomePage" onclick="window.open(this.href); return false;">IETester</a></dt>
<dd>バージョン5.5〜9 previewの動作確認が行える単独のアプリケーションです。ただし9 previewは、XP上では起動しないようです。</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/616/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQueryでクッキーを使ったフォントサイズ変更の方法。</title>
		<link>http://www.almondlab.jp/notes/606?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=jquery%25e3%2581%25a7%25e3%2582%25af%25e3%2583%2583%25e3%2582%25ad%25e3%2583%25bc%25e3%2582%2592%25e4%25bd%25bf%25e3%2581%25a3%25e3%2581%259f%25e3%2583%2595%25e3%2582%25a9%25e3%2583%25b3%25e3%2583%2588%25e3%2582%25b5%25e3%2582%25a4%25e3%2582%25ba%25e5%25a4%2589%25e6%259b%25b4%25e3%2581%25ae%25e6%2596%25b9%25e6%25b3%2595</link>
		<comments>http://www.almondlab.jp/notes/606#comments</comments>
		<pubDate>Sun, 16 May 2010 14:36:49 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=606</guid>
		<description><![CDATA[jQueryでフォントサイズのスタイルシートを動的に切り替えて、現在表示しているスタイルシートをクッキーに保存する方法です。]]></description>
			<content:encoded><![CDATA[<p>jQueryでフォントサイズのスタイルシートを動的に切り替えて、現在表示しているスタイルシートをクッキーに保存する方法です。<br />
スタイルシートは、あらかじめフォントのサイズごとに3種類用意しておきます。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;">font-small.css
font-default.css
font-large.css</pre></td></tr></table></div>

<p>次のコードでは、ページ内にレイアウト用など複数のスタイルシートを読み込むことを想定して、フォントサイズ用のスタイルシートのみを切り替えています。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//フォントサイズ用のCSSファイル名</span>
	<span style="color: #003366; font-weight: bold;">var</span> css_default <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;font-default.css&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//クッキーから読み込んで、現在のCSSファイルを設定</span>
	<span style="color: #003366; font-weight: bold;">var</span> css_current <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> css_default<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//フォントサイズ用CSSのリンク</span>
	<span style="color: #003366; font-weight: bold;">var</span> link <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;link[href=&quot;</span><span style="color: #339933;">+</span>css_default<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//リンクのhref属性に現在のCSSファイルを読み込み</span>
	link.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #339933;">,</span> css_current<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//クリックされたサイズに変更して、クッキーに書き込み</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul#font-size li&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    	css_current <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;font-&quot;</span><span style="color: #339933;">+</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;class&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;.css&quot;</span><span style="color: #339933;">;</span>
		link.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #339933;">,</span> css_current<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #339933;">,</span> css_current<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>expires<span style="color: #339933;">:</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>&lt;head&gt;タグ内にjQueryの本体と、「jquery.cookie.js」を読み込みます。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;base.css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;all&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;font-default.css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;all&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery-1.4.2.min.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.cookie.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></td></tr></table></div>

<p>フォント切り替えのためのボタンを、ページ内に&lt;li&gt;で記述します。<br />
クラス名が、スタイルシートのファイル名に関連しています。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;font-size&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;small&quot;</span>&gt;</span>small<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;default&quot;</span>&gt;</span>default<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;large&quot;</span>&gt;</span>large<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/606/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPで祝日表示付きカレンダーの作成。</title>
		<link>http://www.almondlab.jp/labs/598?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=php%25e3%2581%25a7%25e7%25a5%259d%25e6%2597%25a5%25e8%25a1%25a8%25e7%25a4%25ba%25e4%25bb%2598%25e3%2581%258d%25e3%2582%25ab%25e3%2583%25ac%25e3%2583%25b3%25e3%2583%2580%25e3%2583%25bc%25e3%2581%25ae%25e4%25bd%259c%25e6%2588%2590%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/labs/598#comments</comments>
		<pubDate>Sun, 16 May 2010 05:17:51 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[labs]]></category>
		<category><![CDATA[PEAR]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=598</guid>
		<description><![CDATA[PHPのPEARライブラリを使って、祝日の表示を加えたカレンダーの作成方法です。]]></description>
			<content:encoded><![CDATA[<p>PHPのPEARライブラリを使って、祝日の表示を加えたカレンダーの作成方法です。<br />
カレンダーの作成には「<a href="http://pear.php.net/package/Calendar/" onclick="window.open(this.href); return false;">Calendar</a>」ライブラリ、祝日の取得には「<a href="http://pear.php.net/package/Date_Holidays_Japan" onclick="window.open(this.href); return false;">Date_Holidays_Japan</a>」ライブラリを利用しています。<br />
<span class="link"><a href="http://www.almondlab.jp/wp-content/uploads/calendar" onclick="window.open(this.href); return false;">サンプルはこちら</a></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Calendar/Month/Weekdays.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Date/Holidays.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$current_year</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$current_month</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$calMonth</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Calendar_Month_Weekdays<span style="color: #009900;">&#40;</span><span style="color: #000088;">$current_year</span><span style="color: #339933;">,</span> <span style="color: #000088;">$current_month</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//第3引数の0は週の最初を日曜に</span>
<span style="color: #000088;">$calMonth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">build</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ja</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;data/Date_Holidays_Japan/lang/Japan/ja_JP.xml&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dh</span> <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>Date_Holidays<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Japan&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$current_year</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ja_JP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dh</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addTranslationFile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ja</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ja_JP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$holidays</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//祝日の月日をキーに祝日名を配列に格納</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$dh</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getHolidays</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$holidays</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$value</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">format</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%m<span style="color: #009933; font-weight: bold;">%d</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTitle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;h2&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$current_year</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;年&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$current_month</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;月&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/h2&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;table class=<span style="color: #000099; font-weight: bold;">\&quot;</span>calendar<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;thead&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;tr&gt;&lt;th&gt;日&lt;/th&gt;&lt;th&gt;月&lt;/th&gt;&lt;th&gt;火&lt;/th&gt;&lt;th&gt;水&lt;/th&gt;&lt;th&gt;木&lt;/th&gt;&lt;th&gt;金&lt;/th&gt;&lt;th&gt;土&lt;/th&gt;&lt;/tr&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/thead&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;tbody&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$day</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$calMonth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$day</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isFirst</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;tr&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$day</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isEmpty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> 
		<span style="color: #000088;">$date</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%02d</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$day</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">thisMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%02d</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$day</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">thisDay</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">array_key_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$date</span><span style="color: #339933;">,</span> <span style="color: #000088;">$holidays</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;td class=<span style="color: #000099; font-weight: bold;">\&quot;</span>holiday<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//祝日のとき</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$day</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isFirst</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;td class=<span style="color: #000099; font-weight: bold;">\&quot;</span>sun<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//週の最初（日曜）のとき</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$day</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isLast</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;td class=<span style="color: #000099; font-weight: bold;">\&quot;</span>sat<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//週の最後（土曜）のとき</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;td&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>day<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$day</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">thisDay</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/span&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//祝日に該当する月日の場合、祝日名を出力</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">array_key_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$date</span><span style="color: #339933;">,</span> <span style="color: #000088;">$holidays</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>holiday<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$holidays</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$date</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/span&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/td&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> 
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$day</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isLast</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/tr&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> 
	<span style="color: #009900;">&#125;</span> 
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/tbody&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/table&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>あらかじめ祝日の月日、名称を配列に格納しておき、カレンダー生成のループの中で、祝日の判定を行っています。</p>
<div class="space"></div>
<p><span class="link"><a href="http://pear.php.net/package/Calendar/" onclick="window.open(this.href); return false;">PEAR Calendar</a></span><br />
<span class="link"><a href="http://pear.php.net/package/Date_Holidays_Japan" onclick="window.open(this.href); return false;">PEAR Date_Holidays_Japan</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/labs/598/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActionScriptでフルスクリーン表示のメモ。</title>
		<link>http://www.almondlab.jp/notes/589?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=actionscript%25e3%2581%25a7%25e3%2583%2595%25e3%2583%25ab%25e3%2582%25b9%25e3%2582%25af%25e3%2583%25aa%25e3%2583%25bc%25e3%2583%25b3%25e8%25a1%25a8%25e7%25a4%25ba%25e3%2581%25ae%25e3%2583%25a1%25e3%2583%25a2%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/589#comments</comments>
		<pubDate>Sat, 15 May 2010 06:10:48 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[FLASH]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=589</guid>
		<description><![CDATA[ActionScriptでフルスクリーン表示のためのスクリプトのメモです。]]></description>
			<content:encoded><![CDATA[<p>ActionScriptでフルスクリーン表示のためのスクリプトのメモです。<br />
ステージの原点と左上にして、ウィンドウサイズの変化による拡大縮小は無効の設定です。<br />
ウィンドウ（ステージ）がリサイズされた際に「resizeWindow」を実行します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">StageAlign</span>;
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">StageScaleMode</span>;
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
&nbsp;
<span style="color: #004993;">stage</span>.<span style="color: #004993;">scaleMode</span> = <span style="color: #004993;">StageScaleMode</span>.<span style="color: #004993;">NO_SCALE</span>;
<span style="color: #004993;">stage</span>.<span style="color: #004993;">align</span> = <span style="color: #004993;">StageAlign</span>.<span style="color: #004993;">TOP_LEFT</span>;
<span style="color: #004993;">stage</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">RESIZE</span>, resizeWindow<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> resizeWindow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #009900;">//ウィンドウがリサイズされた際の処理</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/589/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AutomatorでPDFファイルを統合。</title>
		<link>http://www.almondlab.jp/notes/582?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=automator%25e3%2581%25a7pdf%25e3%2583%2595%25e3%2582%25a1%25e3%2582%25a4%25e3%2583%25ab%25e3%2582%2592%25e7%25b5%25b1%25e5%2590%2588%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/582#comments</comments>
		<pubDate>Fri, 14 May 2010 06:48:24 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=582</guid>
		<description><![CDATA[MacOS Xに付属しているAutomatorを使って、PDFファイルを統合する方法です。]]></description>
			<content:encoded><![CDATA[<p>MacOS Xに付属している作業を自動化するためのアプリケーション「Automator」を使うと、複数のPDFファイルを簡単に統合できます。<br />
次の手順でワークフローを組み立てると、初めに統合するためのPDFファイルをダイアログから選択して、統合の処理を自動で行い、デスクトップに「document.pdf」というファイル名で保存します。<br />
<img src="http://www.almondlab.jp/wp-content/uploads/automator-combine-pdf.png" alt="PDFの統合" width="579" height="588" class="frame space" style="padding:0px;" /><br />
そのほかに便利な使い方として、複数の画像ファイルを一つのPDFに変換して統合する場合には、次のような2ステップで行えます。<br />
<img src="http://www.almondlab.jp/wp-content/uploads/automator-convert-pdf-from-image.png" alt="画像ファイルからPDFの統合" width="579" height="360" class="frame space" style="padding:0px;" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/582/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SimplepieでRSSを表示する方法。</title>
		<link>http://www.almondlab.jp/notes/573?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=simplepie%25e3%2581%25a7rss%25e3%2582%2592%25e8%25a1%25a8%25e7%25a4%25ba%25e3%2581%2599%25e3%2582%258b%25e6%2596%25b9%25e6%25b3%2595%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/573#comments</comments>
		<pubDate>Sun, 09 May 2010 10:00:48 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=573</guid>
		<description><![CDATA[他のサイトのRSSフィードを、「Simplepie」というクラスライブラリを使い表示する方法です。]]></description>
			<content:encoded><![CDATA[<p>他のサイトのRSSフィードを、「<a href="http://simplepie.org/" onclick="window.open(this.href); return false;">Simplepie</a>」というクラスライブラリを使い表示する方法です。基本的な使い方は次の通りです。最新から5件のタイトル、投稿日、パーマリンクを表示しています。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;simplepie/simplepie.inc&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$feed</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimplePie<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$feed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_feed_url</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://www.almondlab.jp/feed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$feed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">enable_cache</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$feed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$feed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">handle_content_type</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$feed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_items</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_permalink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_title</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$date</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;(Y年m月d日)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$link</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$title</span><span style="color: #339933;">.</span><span style="color: #000088;">$date</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/a&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>複数のサイトのRSSフィードを取得したい場合には、「set_feed_url」メソッドで、URLを配列のかたちで渡します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$feed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_feed_url</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">&quot;http://www.almondlab.jp/feed&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;http://www.example.jp/feed&quot;</span>
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>上記ではキャッシュを無効にしていますが、キャッシュを利用する場合には、「$feed->enable_cache(false)」を削除して、代わりに次のように記述します。キャッシュを保存するディレクトリ、保存期間を指定します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$feed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_cache_location</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cache/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//保存するディレクトリ</span>
<span style="color: #000088;">$feed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_cache_duration</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//単位は秒で指定</span></pre></td></tr></table></div>

<p><span class="link"><a href="http://simplepie.org/" onclick="window.open(this.href); return false;">Simplepie</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/573/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPressで登録ユーザーのみに閲覧を制限する方法。</title>
		<link>http://www.almondlab.jp/notes/565?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=wordpress%25e3%2581%25a7%25e7%2599%25bb%25e9%258c%25b2%25e3%2583%25a6%25e3%2583%25bc%25e3%2582%25b6%25e3%2583%25bc%25e3%2581%25ae%25e3%2581%25bf%25e3%2581%25ab%25e9%2596%25b2%25e8%25a6%25a7%25e3%2582%2592%25e5%2588%25b6%25e9%2599%2590%25e3%2581%2599%25e3%2582%258b%25e6%2596%25b9%25e6%25b3%2595%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/565#comments</comments>
		<pubDate>Wed, 05 May 2010 04:53:33 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=565</guid>
		<description><![CDATA[サイト全体、または一部のページに対して、登録ユーザーのみに閲覧を制限する方法です。]]></description>
			<content:encoded><![CDATA[<p>サイト全体、または一部のページに対して、登録ユーザーのみに閲覧を制限したい場合には、テーマのテンプレートファイル内に、次のコードを追加します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>is_user_logged_in<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> auth_redirect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>ログインしていない状態で該当するテンプレートのページを開こうとした場合、ログイン画面に移りユーザー名、パスワードの入力を求められます。<br />
そこでログインするともとのページにリダイレクトされ、ページの閲覧が可能になります。<br />
「is_page()」「is_category()」などと組み合わせると、必要なページのみに制限をかけることができます。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/565/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ウィンドウ内をスクロールするパネル。</title>
		<link>http://www.almondlab.jp/labs/557?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=%25e3%2582%25a6%25e3%2582%25a3%25e3%2583%25b3%25e3%2583%2589%25e3%2582%25a6%25e5%2586%2585%25e3%2582%2592%25e3%2582%25b9%25e3%2582%25af%25e3%2583%25ad%25e3%2583%25bc%25e3%2583%25ab%25e3%2581%2599%25e3%2582%258b%25e3%2583%2591%25e3%2583%258d%25e3%2583%25ab%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/labs/557#comments</comments>
		<pubDate>Sun, 25 Apr 2010 11:46:44 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[labs]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=557</guid>
		<description><![CDATA[jQueryによるウィンドウ内を左右にスクロールするパネルのスクリプトです。]]></description>
			<content:encoded><![CDATA[<p>jQueryによるウィンドウ内を、左右にスクロールするパネルのスクリプトです。<br />
横幅1000pxのパネルを横に5枚並べて、リンクをクリックすることで目的のパネルに移動するスクリプトです。<br />
アニメーションのイージングには「<a href="http://gsgd.co.uk/sandbox/jquery/easing/" onclick="window.open(this.href); return false;">jquery.easing.1.3.js</a>」を利用しています。<br />
<span class="link"><a href="http://www.almondlab.jp/wp-content/uploads/scroll-panel" onclick="window.open(this.href); return false;">サンプルはこちら</a></span></p>
<div class="space"></div>
<h4>index.html</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style.css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;all&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery-1.4.2.min.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.easing.1.3.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
$(function(){
	$(&quot;a.panel-01&quot;).click(function() {scrollGeneral(0)});
	$(&quot;a.panel-02&quot;).click(function() {scrollGeneral(1000)});
	$(&quot;a.panel-03&quot;).click(function() {scrollGeneral(2000)});
	$(&quot;a.panel-04&quot;).click(function() {scrollGeneral(3000)});
	$(&quot;a.panel-05&quot;).click(function() {scrollGeneral(4000)});
&nbsp;
})
function scrollGeneral(pos) {
	$(&quot;div#container&quot;).animate({scrollLeft: pos}, {duration: 750, easing: &quot;easeOutQuint&quot;});
	return false;
}
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>scroll-panel<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- navi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;navi&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:;&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel-01&quot;</span>&gt;</span>01<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:;&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel-02&quot;</span>&gt;</span>02<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:;&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel-03&quot;</span>&gt;</span>03<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:;&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel-04&quot;</span>&gt;</span>04<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:;&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel-05&quot;</span>&gt;</span>05<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- navi --&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;general&quot;</span>&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- panel-01 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel-01&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inner&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>panel-01<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- panel-01 --&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- panel-02 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel-02&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inner&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>panel-02<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- panel-02 --&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- panel-03 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel-03&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inner&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>panel-03<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- panel-03 --&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- panel-04 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel-04&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inner&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>panel-04<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- panel-04 --&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- panel-05 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel-05&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inner&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>panel-05<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- panel-05 --&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- general --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- container --&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></td></tr></table></div>

<h4>style.css</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@charset &quot;utf-8&quot;; </span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/* text -------------------------------------------------------------------------------- */</span>
&nbsp;
<span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
html<span style="color: #00AA00;">,</span>
body <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
html <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/* navi -------------------------------------------------------------------------------- */</span>
&nbsp;
div<span style="color: #cc00cc;">#navi</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/* container -------------------------------------------------------------------------------- */</span>
&nbsp;
div<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/* general -------------------------------------------------------------------------------- */</span>
&nbsp;
div<span style="color: #cc00cc;">#general</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">6000px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #cc00cc;">#general</span> div<span style="color: #6666ff;">.inner</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1000px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">800px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #cc00cc;">#general</span> div<span style="color: #6666ff;">.inner</span> p <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Helvetica<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">60px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#d9d9d9</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span> <span style="color: #933;">60px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/* panels -------------------------------------------------------------------------------- */</span>
&nbsp;
div<span style="color: #cc00cc;">#panel-01</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f8f8f8</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #cc00cc;">#panel-02</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #cc00cc;">#panel-03</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f8f8f8</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #cc00cc;">#panel-04</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #cc00cc;">#panel-05</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f8f8f8</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/labs/557/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupalでプロフィール情報を取り出す時のメモ。</title>
		<link>http://www.almondlab.jp/notes/548?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=drupal%25e3%2581%25a7%25e3%2583%2597%25e3%2583%25ad%25e3%2583%2595%25e3%2582%25a3%25e3%2583%25bc%25e3%2583%25ab%25e6%2583%2585%25e5%25a0%25b1%25e3%2582%2592%25e5%258f%2596%25e3%2582%258a%25e5%2587%25ba%25e3%2581%2599%25e6%2599%2582%25e3%2581%25ae%25e3%2583%25a1%25e3%2583%25a2%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/548#comments</comments>
		<pubDate>Thu, 22 Apr 2010 11:19:58 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=548</guid>
		<description><![CDATA[Drupalのプロフィールモジュールで作成したカスタムフィールドを、データベースから直接取り出す時のメモです。]]></description>
			<content:encoded><![CDATA[<p>Drupalのコアに含まれるプロフィールモジュールではユーザに関連するデータ、本名や電話などを追加で作成できます。プロフィールモジュールで作成したカスタムフィールドを、データベースから直接取り出す時のメモです。<br />
この情報をノードタイプのviewsやcontemplateで使いたい時に、下記のように記述して直接データベースから取得しています。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//uidが3で、プロフィールフィールドのIDが1のデータ</span>
<span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> db_result<span style="color: #009900;">&#40;</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT value FROM {profile_values} WHERE uid = <span style="color: #009933; font-weight: bold;">%d</span> AND fid = <span style="color: #009933; font-weight: bold;">%d</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>viewsでコンテンツにCCKのユーザ参照がある場合は、リレーションシップにした方が簡単です。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/548/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>正規表現でファイルの拡張子を取り除く方法。</title>
		<link>http://www.almondlab.jp/notes/541?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=%25e6%25ad%25a3%25e8%25a6%258f%25e8%25a1%25a8%25e7%258f%25be%25e3%2581%25a7%25e3%2583%2595%25e3%2582%25a1%25e3%2582%25a4%25e3%2583%25ab%25e3%2581%25ae%25e6%258b%25a1%25e5%25bc%25b5%25e5%25ad%2590%25e3%2582%2592%25e5%258f%2596%25e3%2582%258a%25e9%2599%25a4%25e3%2581%258f%25e6%2596%25b9%25e6%25b3%2595%25e3%2580%2582</link>
		<comments>http://www.almondlab.jp/notes/541#comments</comments>
		<pubDate>Sun, 28 Mar 2010 04:10:57 +0000</pubDate>
		<dc:creator>almondlab.</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.almondlab.jp/?p=541</guid>
		<description><![CDATA[PHPの正規表現によるパターンマッチで、ファイル名から拡張子を取り除いた文字列を取り出す方法です。]]></description>
			<content:encoded><![CDATA[<p>PHPの正規表現によるパターンマッチで、ファイル名から拡張子を取り除いた文字列を取り出す方法です。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span>get_filename<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test.txt&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//test</span>
<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span>get_filename<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test.test.txt&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//test.test</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> get_filename<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/(.+)(\.[^.]+$)/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$1</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>パターンマッチ内の1つ目のパーレン「(.+)」で、任意の1文字以上の文字列を表します。<br />
2つ目のパーレン「(\.[^.]+$)」で、文末にある、ドット1文字から始まり、ドット以外の1文字以上の文字列を表しています。<br />
「$1」の部分を「$2」とすることで、2つ目のパーレン（上記の場合「.txt」となります）を取り出すことができます。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.almondlab.jp/notes/541/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
