<?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>cap&#039;n webb &#187; Smarty</title>
	<atom:link href="http://blog.dataich.com/tag/smarty/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dataich.com</link>
	<description>almost all things about it</description>
	<lastBuildDate>Thu, 12 Jan 2012 03:38:00 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Smartyを携帯向けに</title>
		<link>http://blog.dataich.com/2007/07/22/smarty%e3%82%92%e6%90%ba%e5%b8%af%e5%90%91%e3%81%91%e3%81%ab/</link>
		<comments>http://blog.dataich.com/2007/07/22/smarty%e3%82%92%e6%90%ba%e5%b8%af%e5%90%91%e3%81%91%e3%81%ab/#comments</comments>
		<pubDate>Sun, 22 Jul 2007 03:20:00 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Smarty]]></category>

		<guid isPermaLink="false">http://dataich.s15.coreserver.jp/blog/2007/07/22/smarty%e3%82%92%e6%90%ba%e5%b8%af%e5%90%91%e3%81%91%e3%81%ab/</guid>
		<description><![CDATA[Smartyを携帯に対応させようとすると、どうしてもSJISの問題が発生する。 「{」「}」がSJISのコードに含まれるため、テンプレートはSJISでは書けない。 そこで、Smartyのoutputfilterを使用した [...]]]></description>
			<content:encoded><![CDATA[<p>Smartyを携帯に対応させようとすると、どうしてもSJISの問題が発生する。<br />
「{」「}」がSJISのコードに含まれるため、テンプレートはSJISでは書けない。<br />
そこで、Smartyの<a class="wpGallery" href="http://smarty.php.net/manual/ja/advanced.features.outputfilters.php" target="_blank" onclick="pageTracker._trackPageview('/outgoing/smarty.php.net/manual/ja/advanced.features.outputfilters.php?referer=');">outputfilter</a>を使用した。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</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;">//</span>
<span style="color: #666666; font-style: italic;">// 画面出力時に、テンプレートをUTF-8からSJISに変換する。</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #000000; font-weight: bold;">function</span> filterUTF8ToSJIS<span style="color: #009900;">&#40;</span><span style="color: #000088;">$buff</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$smarty</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">mb_convert_encoding</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$buff</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;SJIS&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$smarty</span><span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Smarty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                              <span style="color: #666666; font-style: italic;">//Smartyオブジェクト生成</span>
<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register_outputfilter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;filterUTF8ToSJIS&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//フィルターの登録</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;default_charset&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Shift_JIS&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>            <span style="color: #666666; font-style: italic;">//PHPの設定default_charsetにSJISを設定</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2007/07/22/smarty%e3%82%92%e6%90%ba%e5%b8%af%e5%90%91%e3%81%91%e3%81%ab/&via=dataich&text=Smartyを携帯向けに&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2007/07/22/smarty_e3_82_92_e6_90_ba_e5_b8_af_e5_90_91_e3_81_91_e3_81_ab/_via=dataich_text=Smarty_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2007/07/22/smarty%e3%82%92%e6%90%ba%e5%b8%af%e5%90%91%e3%81%91%e3%81%ab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

