<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>へっぽこ開発室 &#187; Smarty</title>
	<atom:link href="http://wp.foliz.net/archives/category/smarty/feed" rel="self" type="application/rss+xml" />
	<link>http://wp.foliz.net</link>
	<description>webプログラム　php,Smarty,Zend Framework,ajax,pearネタなど～</description>
	<lastBuildDate>Sat, 21 Jan 2012 06:32:52 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Smarty getTemplateTimestampTypeName()エラー</title>
		<link>http://wp.foliz.net/archives/368</link>
		<comments>http://wp.foliz.net/archives/368#comments</comments>
		<pubDate>Thu, 16 Dec 2010 01:55:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Smarty]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/?p=368</guid>
		<description><![CDATA[Smarty3rcから3.0.6 最新版にアップデートしたら以下のエラーが出たのでその対応策 Fatal error: Call to undefined method Smarty_Internal_Resource_ [...]]]></description>
			<content:encoded><![CDATA[<p>Smarty3rcから3.0.6 最新版にアップデートしたら以下のエラーが出たのでその対応策</p>
<p><strong>Fatal error</strong>: Call to undefined method Smarty_Internal_Resource_File::getTemplateTimestampTypeName() in <strong>/var/www/&#8230;</strong></p>
<p><span id="more-368"></span></p>
<p>&#8230;<br />
templates_cに作られてるコンパイル済みphpを削除すると治った（笑）</p>
<p><a href="http://www.smarty.net/">http://www.smarty.net/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/368/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>モバイルサイトをZend Framework+Smartyで構築中</title>
		<link>http://wp.foliz.net/archives/203</link>
		<comments>http://wp.foliz.net/archives/203#comments</comments>
		<pubDate>Fri, 04 Dec 2009 07:16:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Smarty]]></category>
		<category><![CDATA[ZendFramework]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/?p=203</guid>
		<description><![CDATA[いつものごとく、サイトを作るときはZend Framework+Smartyで作ってます。 今回携帯サイトを作ることになったのですが けっこう難しかったのでメモ。 最初の構想はshift-jisでphpもテンプレートもm [...]]]></description>
			<content:encoded><![CDATA[<p>いつものごとく、サイトを作るときはZend Framework+Smartyで作ってます。<br />
今回携帯サイトを作ることになったのですが<br />
けっこう難しかったのでメモ。<br />
<span id="more-203"></span></p>
<p>最初の構想はshift-jisでphpもテンプレートもmySQLはset namesでやっちゃえば<br />
それだけで充分いけるだろうって考えていたのに甘かった。。</p>
<p>最初につまづいたのがshift-jisで書かれたテンプレート。<br />
<strong>Smartyはshift-jisが未対応</strong>のようで、構文エラーを起こします。</p>
<p>なので全てをutf-8で作って最後にshift-jisで出力する作戦に変更。<br />
プラグインフィルターを使って出力直前にエンコード変換させるので<br />
display直前で<br />
$this->register_outputfilter( array($this,&#8221;utf_to_shift_filter&#8221;) );<br />
を入れました。<br />
クラス内で関数名指定をするときはこんな書き方です。<br />
utf_to_shift_filterは単純で単にエンコード変換して返すだけです。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * エンコード変換
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> utf_to_shift_filter<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: #000088;">$buff</span> <span style="color: #339933;">=</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;">'Shift-jis'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'UTF-8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$buff</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>プラグインフィルターを最初に設定しちゃうとfetchでテンプレートを取得するときに変換され、displayで2度変換されちゃいます。<br />
やって欲しいのは最後の1回でいいのでdisplay直前に。</p>
<p>.htaccessファイルに<br />
AddDefaultCharset UTF-8<br />
を入れてあるとheaderに勝手に<br />
Content-Type	text/html; charset=UTF-8<br />
が勝手に入ってしまうので抜きました。</p>
<p>クッキーが使えない想定でパラメーターでセッションを管理します。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'session.use_trans_sid'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>を追加。<br />
サイト内パスが絶対になっているとセッションIDが自動で付きません。<br />
（判明するまで苦労した；）</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/203/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_Mail+Smarty でメール送信</title>
		<link>http://wp.foliz.net/archives/76</link>
		<comments>http://wp.foliz.net/archives/76#comments</comments>
		<pubDate>Mon, 09 Jun 2008 13:35:19 +0000</pubDate>
		<dc:creator>Fou</dc:creator>
				<category><![CDATA[Smarty]]></category>
		<category><![CDATA[ZendFramework]]></category>
		<category><![CDATA[Zend_Mail]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/76</guid>
		<description><![CDATA[Zend Frameworkを使ったアプリケーションでSmartyテンプレートを使ったメール送信プログラム よく使いそうなのでメモメモ。。 ざっと簡単に書くとこんな感じ。 $smarty = new Smarty&#40 [...]]]></description>
			<content:encoded><![CDATA[<p>Zend Frameworkを使ったアプリケーションでSmartyテンプレートを使ったメール送信プログラム<br />
よく使いそうなのでメモメモ。。</p>
<p><span id="more-76"></span></p>
<p>ざっと簡単に書くとこんな感じ。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><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: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">template_dir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'テンプレートフォルダのパス'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">compile_dir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'テンプレート一時フォルダのパス'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assign</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>　<span style="color: #666666; font-style: italic;">//メールテンプレートにassignする</span>
&nbsp;
<span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>subject<span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'メールタイトル'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>body<span style="color: #009900;">&#93;</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'テンプレートファイル'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>fromEmail<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'送り主アドレス'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>fromName<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'送り主名'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>toEmail<span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'送信先アドレス'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>toName<span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'送信先名'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">mb_convert_variables</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ISO-2022-JP'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'EUC-JP'</span><span style="color: #339933;">,</span><span style="color: #000088;">$send</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>fromName<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'=?iso-2022-jp?B?'</span><span style="color: #339933;">.</span><span style="color: #990000;">base64_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>fromName<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'?='</span><span style="color: #339933;">;</span>
&nbsp;
try<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$Mail</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Mail<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ISO-2022-JP'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//送信用</span>
    <span style="color: #000088;">$Mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setFrom</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>fromEmail<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>fromName<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
           <span style="color: #339933;">-&gt;</span><span style="color: #004000;">addTo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>toEmail<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>toName<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
           <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setSubject</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>subject<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
           <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setBodyText</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$send</span><span style="color: #009900;">&#91;</span>body<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
           <span style="color: #339933;">-&gt;</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//エラー処理</span>
catch <span style="color: #009900;">&#40;</span>Zend_Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/76/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smarty 出力フィルター</title>
		<link>http://wp.foliz.net/archives/66</link>
		<comments>http://wp.foliz.net/archives/66#comments</comments>
		<pubDate>Thu, 17 Jan 2008 10:29:43 +0000</pubDate>
		<dc:creator>Fou</dc:creator>
				<category><![CDATA[Smarty]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/66</guid>
		<description><![CDATA[EUC-JPで作ったテンプレート出力をSHIFT-JISに変更する方法。 //プラグインの登録 $smarty-&#62;plugins_dir = array&#40;'plugins',APPLICATION_PATH [...]]]></description>
			<content:encoded><![CDATA[<p>EUC-JPで作ったテンプレート出力をSHIFT-JISに変更する方法。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//プラグインの登録</span>
<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">plugins_dir</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'plugins'</span><span style="color: #339933;">,</span>APPLICATION_PATH<span style="color: #339933;">.</span><span style="color: #0000ff;">'/library/plugins/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//出力フィルターの設定</span>
<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoload_filters</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;output&quot;</span><span style="color: #339933;">=&gt;</span>array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;encode_euctosjis&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>outputfilter.encode_euctosjis.php</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> smarty_outputfilter_encode_euctosjis <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: #000088;">$buff</span> <span style="color: #339933;">=</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;">'SJIS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'EUC'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$buff</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>ただし！！<br />
$smarty->append()を使った場合はエンコードされたのを、display()でまたエンコードされてしまいうまくいかない。。</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/66/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>smarty関数html_select_date</title>
		<link>http://wp.foliz.net/archives/64</link>
		<comments>http://wp.foliz.net/archives/64#comments</comments>
		<pubDate>Wed, 12 Dec 2007 06:36:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Smarty]]></category>
		<category><![CDATA[html_select_date]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/64</guid>
		<description><![CDATA[初期状態をemptyにする方法 色々適当に設定してたら発見。 {html_select_date 　field_array="postege_day" 　time="--" 　year_empty="選択" 　month [...]]]></description>
			<content:encoded><![CDATA[<p>初期状態をemptyにする方法</p>
<p>色々適当に設定してたら発見。</p>
<pre long="smarty" line="1">
{html_select_date
　field_array="postege_day"
　time="--"
　year_empty="選択"
　month_empty="選択"
　day_empty="選択"
　prefix=""
　month_format="%m"
　field_order="YMD"
　end_year="+1"
　field_separator=" / "
}
</pre>
<p>なぜ&#8211;でいけるのか不明。<br />
ソースを解読したほうが早かったのかな・・</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/64/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smarty html_options でonchangeイベント</title>
		<link>http://wp.foliz.net/archives/56</link>
		<comments>http://wp.foliz.net/archives/56#comments</comments>
		<pubDate>Thu, 18 Oct 2007 03:33:24 +0000</pubDate>
		<dc:creator>Fou</dc:creator>
				<category><![CDATA[Smarty]]></category>
		<category><![CDATA[html_options]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/56</guid>
		<description><![CDATA[ほんと今更ながらの話なのですが、SelectタグでonChangeイベントを使いたい場合{html_options}を使わずforeach文で書いていましたが、html_optionsで表現できるんですね。。 {html [...]]]></description>
			<content:encoded><![CDATA[<p>ほんと今更ながらの話なのですが、SelectタグでonChangeイベントを使いたい場合{html_options}を使わずforeach文で書いていましたが、html_optionsで表現できるんですね。。<br />
<span id="more-56"></span></p>
<p><code><br />
{html_options name="pref" options=$prefecture onchange="selectBox()"}<br />
</code><br />
そのまま何も考えず付けたい属性を追加すればいいだけです。<br />
・・・無知ってコワイですねｗ</p>
<p>ついでに以下のようなグループ別けして渡すと勝手にoptgroup属性を付けてくれる。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$prefecture</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
<span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;▼選択して下さい&quot;</span>
<span style="color: #0000ff;">&quot;北海道・東北&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">Array</span> <span style="color: #009900;">&#40;</span>
  <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;北海道&quot;</span>
  <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;青森県&quot;</span>
  <span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;岩手県&quot;</span>
  <span style="color: #cc66cc;">4</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;宮城県&quot;</span>
  <span style="color: #cc66cc;">5</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;秋田県&quot;</span>
  <span style="color: #cc66cc;">6</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;山形県&quot;</span>
  <span style="color: #cc66cc;">7</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;福島県&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">&quot;関東&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">Array</span> <span style="color: #009900;">&#40;</span>
  <span style="color: #cc66cc;">8</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;茨城県&quot;</span>
  <span style="color: #cc66cc;">9</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;栃木県&quot;</span>
  <span style="color: #cc66cc;">10</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;群馬県&quot;</span>
  <span style="color: #cc66cc;">11</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;埼玉県&quot;</span>
  <span style="color: #cc66cc;">12</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;千葉県&quot;</span>
  <span style="color: #cc66cc;">13</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;東京都&quot;</span>
  <span style="color: #cc66cc;">14</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;神奈川県&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">&quot;甲信越・北陸&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">Array</span> <span style="color: #009900;">&#40;</span>
  <span style="color: #cc66cc;">15</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;新潟県&quot;</span>
  <span style="color: #cc66cc;">16</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;富山県&quot;</span>
  <span style="color: #cc66cc;">17</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;石川県&quot;</span>
  <span style="color: #cc66cc;">18</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;福井県&quot;</span>
  <span style="color: #cc66cc;">19</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;山梨県&quot;</span>
  <span style="color: #cc66cc;">20</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;長野県&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">&quot;東海&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">Array</span> <span style="color: #009900;">&#40;</span>
  <span style="color: #cc66cc;">21</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;岐阜県&quot;</span>
  <span style="color: #cc66cc;">22</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;静岡県&quot;</span>
  <span style="color: #cc66cc;">23</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;愛知県&quot;</span>
  <span style="color: #cc66cc;">24</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;三重県&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">&quot;近畿&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">Array</span> <span style="color: #009900;">&#40;</span>
  <span style="color: #cc66cc;">25</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;滋賀県&quot;</span>
  <span style="color: #cc66cc;">26</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;京都府&quot;</span>
  <span style="color: #cc66cc;">27</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;大阪府&quot;</span>
  <span style="color: #cc66cc;">28</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;兵庫県&quot;</span>
  <span style="color: #cc66cc;">29</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;奈良県&quot;</span>
  <span style="color: #cc66cc;">30</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;和歌山県&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">&quot;中国・四国&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">Array</span> <span style="color: #009900;">&#40;</span>
  <span style="color: #cc66cc;">31</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;鳥取県&quot;</span>
  <span style="color: #cc66cc;">32</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;島根県&quot;</span>
  <span style="color: #cc66cc;">33</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;岡山県&quot;</span>
  <span style="color: #cc66cc;">34</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;広島県&quot;</span>
  <span style="color: #cc66cc;">35</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;山口県&quot;</span>
  <span style="color: #cc66cc;">36</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;徳島県&quot;</span>
  <span style="color: #cc66cc;">37</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;香川県&quot;</span>
  <span style="color: #cc66cc;">38</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;愛媛県&quot;</span>
  <span style="color: #cc66cc;">39</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;高知県&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">&quot;九州・沖縄&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">Array</span> <span style="color: #009900;">&#40;</span>
  <span style="color: #cc66cc;">40</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;福岡県&quot;</span>
  <span style="color: #cc66cc;">41</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;佐賀県&quot;</span>
  <span style="color: #cc66cc;">42</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;長崎県&quot;</span>
  <span style="color: #cc66cc;">43</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;熊本県&quot;</span>
  <span style="color: #cc66cc;">44</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;大分県&quot;</span>
  <span style="color: #cc66cc;">45</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;宮崎県&quot;</span>
  <span style="color: #cc66cc;">46</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;鹿児島県&quot;</span>
  <span style="color: #cc66cc;">47</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;沖縄県&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span></pre></div></div>

<p>（debugウインドウから適当に編集したので間違いがあるかも）</p>
<p>↓<br />
結果</p>
<select name="pref">
<option label="▼選択して下さい" value="0">▼選択して下さい</option>
<p> <optgroup label="北海道・東北"></optgroup><br />
<option label="北海道" value="1">北海道</option>
<option label="青森県" value="2">青森県</option>
<option label="岩手県" value="3">岩手県</option>
<option label="宮城県" value="4">宮城県</option>
<option label="秋田県" value="5">秋田県</option>
<option label="山形県" value="6">山形県</option>
<option label="福島県" value="7">福島県</option>
<p> <optgroup label="関東"></optgroup><br />
<option label="茨城県" value="8">茨城県</option>
<option label="栃木県" value="9">栃木県</option>
<option label="群馬県" value="10">群馬県</option>
<option label="埼玉県" value="11">埼玉県</option>
<option label="千葉県" value="12">千葉県</option>
<option label="東京都" value="13">東京都</option>
<option label="神奈川県" value="14">神奈川県</option>
<p> <optgroup label="甲信越・北陸"></optgroup><br />
<option label="新潟県" value="15">新潟県</option>
<option label="富山県" value="16">富山県</option>
<option label="石川県" value="17">石川県</option>
<option label="福井県" value="18">福井県</option>
<option label="山梨県" value="19">山梨県</option>
<option label="長野県" value="20">長野県</option>
<p> <optgroup label="東海"></optgroup><br />
<option label="岐阜県" value="21">岐阜県</option>
<option label="静岡県" value="22">静岡県</option>
<option label="愛知県" value="23">愛知県</option>
<option label="三重県" value="24">三重県</option>
<p> <optgroup label="近畿"></optgroup><br />
<option label="滋賀県" value="25">滋賀県</option>
<option label="京都府" value="26">京都府</option>
<option label="大阪府" value="27">大阪府</option>
<option label="兵庫県" value="28">兵庫県</option>
<option label="奈良県" value="29">奈良県</option>
<option label="和歌山県" value="30">和歌山県</option>
<p> <optgroup label="中国・四国"></optgroup><br />
<option label="鳥取県" value="31">鳥取県</option>
<option label="島根県" value="32">島根県</option>
<option label="岡山県" value="33">岡山県</option>
<option label="広島県" value="34">広島県</option>
<option label="山口県" value="35">山口県</option>
<option label="徳島県" value="36">徳島県</option>
<option label="香川県" value="37">香川県</option>
<option label="愛媛県" value="38">愛媛県</option>
<option label="高知県" value="39">高知県</option>
<p> <optgroup label="九州・沖縄"></optgroup><br />
<option label="福岡県" value="40">福岡県</option>
<option label="佐賀県" value="41">佐賀県</option>
<option label="長崎県" value="42">長崎県</option>
<option label="熊本県" value="43">熊本県</option>
<option label="大分県" value="44">大分県</option>
<option label="宮崎県" value="45">宮崎県</option>
<option label="鹿児島県" value="46">鹿児島県</option>
<option label="沖縄県" value="47">沖縄県</option>
</select>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/56/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smarty get_template_vars</title>
		<link>http://wp.foliz.net/archives/53</link>
		<comments>http://wp.foliz.net/archives/53#comments</comments>
		<pubDate>Mon, 01 Oct 2007 12:13:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Smarty]]></category>
		<category><![CDATA[未分類]]></category>
		<category><![CDATA[get_template_vars]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/53</guid>
		<description><![CDATA[今回初めて使った関数なので一応メモ array get_template_vars ( [string varname]) パラメータが与えられない場合は、 全ての割り当てられた変数の配列を返します。 $content_ [...]]]></description>
			<content:encoded><![CDATA[<p>今回初めて使った関数なので一応メモ</p>
<p><code>array <a href="http://smarty.php.net/manual/ja/api.get.template.vars.php" title="get_template_vars">get_template_vars</a> ( [string varname])</code></p>
<p>パラメータが与えられない場合は、 全ての割り当てられた変数の配列を返します。</p>
<p>$content_block が無い場合デフォルトのテンプレートを使う</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> append<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$template</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$block</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'content'</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: #339933;">!</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_param<span style="color: #009900;">&#91;</span>controller<span style="color: #009900;">&#93;</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: #339933;">!</span><span style="color: #000088;">$template</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$template</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_param<span style="color: #009900;">&#91;</span>action<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_smarty<span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$template</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.tpl'</span> <span style="color: #339933;">,</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_smarty<span style="color: #339933;">-&gt;</span><span style="color: #004000;">append</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$block</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_block'</span><span style="color: #339933;">,</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> showPage<span style="color: #009900;">&#40;</span><span style="color: #000088;">$base</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;base&quot;</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: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_smarty<span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_template_vars</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'content_block'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">append</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_smarty<span style="color: #339933;">-&gt;</span><span style="color: #004000;">display</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$base</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.tpl'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/53/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smarty Splitプラグイン</title>
		<link>http://wp.foliz.net/archives/30</link>
		<comments>http://wp.foliz.net/archives/30#comments</comments>
		<pubDate>Thu, 06 Sep 2007 10:59:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Smarty]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/30</guid>
		<description><![CDATA[前回の http://smarty.incutio.com/にある　便利そうな　Block Functions　SplitとSplit_rowプラグインを試した。 　 split &#8211; Loop structu [...]]]></description>
			<content:encoded><![CDATA[<p>前回の<a alt="http://smarty.incutio.com/" href="http://smarty.incutio.com/"><br />
http://smarty.incutio.com/</a>にある　便利そうな　<strong>Block Functions</strong>　SplitとSplit_rowプラグインを試した。</p>
<ul>　</p>
<li><a href="http://smarty.incutio.com/?page=split">split</a> &#8211; Loop structure similar to foreach that breaks an array into groups as evenly as possible then iterates over those groups. Intended to allow multi column layouts with a minimum of markup in the template code.</li>
<li><a href="http://smarty.incutio.com/?page=split_row">split_row</a> &#8211; A variant of split that returns the chunks as rows instead of as columns</li>
</ul>
<p>それぞれ　block.split.php　block.split_row.php ファイルを作りプラグインフォルダに放り込む。<br />
さて、普通ならここで使えるのだが、</p>
<blockquote><p><code>Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in <em>略</em>/block.split.php on line 104<br />
</code></p></blockquote>
<p>こんなエラーが。。</p>
<p>調べてみると、どうやら参照渡しのやり方が非推進の方法でやられてるらしい。<br />
<a href="http://php.net/manual/ja/ini.core.php">http://php.net/manual/ja/ini.core.php</a></p>
<p>なんとか使えるように修正しようとしたがよくわからず挫折しました＾＾；<br />
allow_call_time_pass_referenceの設定を1のまま使えるようにした方がいたら教えて下さい＞＜</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/30/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smarty BBcode修飾子</title>
		<link>http://wp.foliz.net/archives/29</link>
		<comments>http://wp.foliz.net/archives/29#comments</comments>
		<pubDate>Wed, 05 Sep 2007 13:16:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Smarty]]></category>
		<category><![CDATA[bbcode]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/29</guid>
		<description><![CDATA[Smartyの修飾子を使ってBBcodeをHTMLに変換してしまうとってもナイスなプラグイン。 http://smarty.incutio.com/ こちらのサイトの Extending Smarty 2.SmartyP [...]]]></description>
			<content:encoded><![CDATA[<p>Smartyの修飾子を使ってBBcodeをHTMLに変換してしまうとってもナイスなプラグイン。</p>
<p><a href="http://smarty.incutio.com/" title="http://smarty.incutio.com/"></p>
<p>http://smarty.incutio.com/</p>
<p><img src="http://wp.foliz.net/wp-content/uploads/2007/09/output7.thumbnail.jpg" alt="http://smarty.incutio.com/" /></a></p>
<p>こちらのサイトの<br />
<strong>Extending Smarty</strong><br />
2.SmartyPlugins にある<br />
<strong>Modifiers</strong><br />
3.　<a href="http://smarty.incutio.com/?page=BBCodePlugin" title="BBcodePlugin">BBCodePlugin</a> &#8211; Converts BBCode style tags to HTML</p>
<p>使い方はとっても簡単<br />
BBcodeで書かれたテキストを</p>

<div class="wp_syntax"><div class="code"><pre class="smarty" style="font-family:monospace;"><span style="color: #D36900;">&#123;</span><span style="color: #00aaff;">$hoge</span>|bbcode2html<span style="color: #D36900;">&#125;</span></pre></div></div>

<p>と記述するだけおｋ</p>
<p>私の場合、改行タグも付けたかったので最後をちょっと改造</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #990000;">nl2br</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//改行をに</span>
  <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$preg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array_values</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$preg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$message</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>他にもとても素晴らしいプラグインが多数紹介されているのでSmarty使いには必見のサイトではないでしょうか。</p>
<p>・・・ところで何故bbcode2htmlなんでしょうね？</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/29/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>getパラメーターを自動作成するsmartyプラグイン</title>
		<link>http://wp.foliz.net/archives/24</link>
		<comments>http://wp.foliz.net/archives/24#comments</comments>
		<pubDate>Tue, 04 Sep 2007 14:34:54 +0000</pubDate>
		<dc:creator>Fou</dc:creator>
				<category><![CDATA[Smarty]]></category>
		<category><![CDATA[プラグイン]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/24</guid>
		<description><![CDATA[getパラメーターをURLに戻すプラグイン。 追加や変更したいパラメーターをそのままプラグイン変数に追加するだけの簡単設計ｗ 例 index.php?mode=top&#38;page=main &#123;url_pa [...]]]></description>
			<content:encoded><![CDATA[<p>getパラメーターをURLに戻すプラグイン。<br />
追加や変更したいパラメーターをそのままプラグイン変数に追加するだけの簡単設計ｗ</p>
<p>例<br />
index.php?mode=top&amp;page=main</p>

<div class="wp_syntax"><div class="code"><pre class="smarty" style="font-family:monospace;"><span style="color: #D36900;">&#123;</span>url_params hoge<span style="color: #D36900;">=</span><span style="color: #ff0000;">&quot;123&quot;</span> hoge2<span style="color: #D36900;">=</span><span style="color: #ff0000;">&quot;456&quot;</span><span style="color: #D36900;">&#125;</span></pre></div></div>

<p>↓<br />
mode=top&amp;page=main&amp;hoge=123&amp;hoge2=456</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> smarty_function_url_params<span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span><span style="color: #339933;">,&amp;</span>amp<span style="color: #339933;">;</span><span style="color: #000088;">$o_smarty</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$params</span><span style="color: #339933;">=</span><span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #339933;">,</span><span style="color: #000088;">$params</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$value</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: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$array</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$prm</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'[]='</span><span style="color: #339933;">.</span><span style="color: #000088;">$array</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$value</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$prm</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'='</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #339933;">@</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;amp;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$prm</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/24/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

