<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.nonip.net/index.php?action=history&amp;feed=atom&amp;title=Php%2FSmarty%2F%E6%8A%80%E8%A1%93%E3%83%A1%E3%83%A2</id>
	<title>Php/Smarty/技術メモ - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.nonip.net/index.php?action=history&amp;feed=atom&amp;title=Php%2FSmarty%2F%E6%8A%80%E8%A1%93%E3%83%A1%E3%83%A2"/>
	<link rel="alternate" type="text/html" href="https://wiki.nonip.net/index.php?title=Php/Smarty/%E6%8A%80%E8%A1%93%E3%83%A1%E3%83%A2&amp;action=history"/>
	<updated>2026-04-30T01:32:20Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.nonip.net/index.php?title=Php/Smarty/%E6%8A%80%E8%A1%93%E3%83%A1%E3%83%A2&amp;diff=21556&amp;oldid=prev</id>
		<title>Admin: /* 指定日以降にNEWを付ける */</title>
		<link rel="alternate" type="text/html" href="https://wiki.nonip.net/index.php?title=Php/Smarty/%E6%8A%80%E8%A1%93%E3%83%A1%E3%83%A2&amp;diff=21556&amp;oldid=prev"/>
		<updated>2026-04-08T08:16:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;指定日以降にNEWを付ける&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年4月8日 (水) 08:16時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l70&quot;&gt;70行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;70行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  {{&amp;lt;nowiki /&amp;gt;if $smarty.now|date_format:&amp;#039;%Y-%m-%d %H:%M:%S&amp;#039;&amp;gt;=&amp;#039;2011-11-14 08:30:00&amp;#039;}}New!!{{&amp;lt;nowiki /&amp;gt;/if}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  {{&amp;lt;nowiki /&amp;gt;if $smarty.now|date_format:&amp;#039;%Y-%m-%d %H:%M:%S&amp;#039;&amp;gt;=&amp;#039;2011-11-14 08:30:00&amp;#039;}}New!!{{&amp;lt;nowiki /&amp;gt;/if}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  {{&amp;lt;nowiki /&amp;gt;if $smarty.now|date_format:&amp;#039;%Y-%m-%d&amp;#039;&amp;gt;=&amp;#039;2011-11-14&amp;#039;}}New!!{{&amp;lt;nowiki /&amp;gt;/if}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  {{&amp;lt;nowiki /&amp;gt;if $smarty.now|date_format:&amp;#039;%Y-%m-%d&amp;#039;&amp;gt;=&amp;#039;2011-11-14&amp;#039;}}New!!{{&amp;lt;nowiki /&amp;gt;/if}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;==まとめてassign==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;$data = array(&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &#039;randomwords&#039; =&amp;gt; $words,&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &#039;search_dir_name&#039; =&amp;gt; &#039;/search/&#039;,&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;$smarty-&amp;gt;assign($data);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.nonip.net/index.php?title=Php/Smarty/%E6%8A%80%E8%A1%93%E3%83%A1%E3%83%A2&amp;diff=828&amp;oldid=prev</id>
		<title>127.0.0.1: ページの作成:「==全角カナを半角カナへ変換== Smarty/libs/pluginsに modifier.mbkana.php  &lt;?php  function smarty_modifier_mbkana($string, $char_set = &#039;UTF-8&#039;)  {    return mb_...」</title>
		<link rel="alternate" type="text/html" href="https://wiki.nonip.net/index.php?title=Php/Smarty/%E6%8A%80%E8%A1%93%E3%83%A1%E3%83%A2&amp;diff=828&amp;oldid=prev"/>
		<updated>2015-05-19T18:17:48Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「==全角カナを半角カナへ変換== Smarty/libs/pluginsに modifier.mbkana.php  &amp;lt;?php  function smarty_modifier_mbkana($string, $char_set = &amp;#039;UTF-8&amp;#039;)  {    return mb_...」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==全角カナを半角カナへ変換==&lt;br /&gt;
Smarty/libs/pluginsに&lt;br /&gt;
modifier.mbkana.php&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 function smarty_modifier_mbkana($string, $char_set = &amp;#039;UTF-8&amp;#039;)&lt;br /&gt;
 {&lt;br /&gt;
   return mb_convert_kana($string, &amp;quot;ka&amp;quot;, $char_set);&lt;br /&gt;
 }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
を追加&lt;br /&gt;
使い方：{$kana|mbkana:sjis-win}&lt;br /&gt;
&lt;br /&gt;
==utf8に変換==&lt;br /&gt;
Smarty/libs/pluginsに&lt;br /&gt;
modifier.utf8.php&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 function smarty_modifier_utf8($string, $char_set = &amp;#039;ASCII,JIS,UTF-8,EUC-JP,SJIS&amp;#039;)&lt;br /&gt;
 {&lt;br /&gt;
   return mb_convert_encoding($string, &amp;#039;UTF-8&amp;#039;, $char_set);&lt;br /&gt;
 }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
を追加&lt;br /&gt;
使い方：{$value|utf8:sjis-win}&lt;br /&gt;
&lt;br /&gt;
==便利プラグイン==&lt;br /&gt;
日本語文字丸め処理（文字列幅制御）&lt;br /&gt;
mb_strimwidth&lt;br /&gt;
http://d.hatena.ne.jp/kidd-number5/20060417/1145253097&lt;br /&gt;
&lt;br /&gt;
日本語文字丸め処理（文字数制御）&lt;br /&gt;
mbtruncate&lt;br /&gt;
http://tdiary.ishinao.net/20040423.html&lt;br /&gt;
&lt;br /&gt;
==キャッシュを使用==&lt;br /&gt;
 $smarty = new Smarty();&lt;br /&gt;
 // キャッシュ有効設定&lt;br /&gt;
 $smarty-&amp;gt;caching        = 1;&lt;br /&gt;
 // テンプレートファイルの更新チェックフラグ&lt;br /&gt;
 $smarty-&amp;gt;compile_check  = false;&lt;br /&gt;
 // キャッシュするディレクトリ設定&lt;br /&gt;
 $smarty-&amp;gt;cache_dir      = dirname(__FILE__) . &amp;#039;/cache/&amp;#039;;&lt;br /&gt;
 // キャッシュの生存時間(秒)を設定&lt;br /&gt;
 $smarty-&amp;gt;cache_lifetime = 600;&lt;br /&gt;
 if ($smarty-&amp;gt;is_cached(&amp;quot;index.tpl&amp;quot;, $cache_id)) {&lt;br /&gt;
     $smarty-&amp;gt;assign(&amp;quot;random&amp;quot; ,rand());&lt;br /&gt;
 }&lt;br /&gt;
 $smarty-&amp;gt;display(&amp;quot;index.tpl&amp;quot;, $cache_id);&lt;br /&gt;
&lt;br /&gt;
==キャッシュで部分的に動的動作==&lt;br /&gt;
 *main.tpl&lt;br /&gt;
 {{&amp;lt;nowiki /&amp;gt;insert name=&amp;quot;getTest&amp;quot; title=&amp;quot;test&amp;quot;}}&lt;br /&gt;
 *main.php(プラグイン未使用の場合&lt;br /&gt;
 function insert_getTest($params, &amp;amp;$smarty) {&lt;br /&gt;
    $smarty-&amp;gt;assign(&amp;#039;title&amp;#039;, $params[&amp;#039;title&amp;#039;]);&lt;br /&gt;
    return $smarty-&amp;gt;fetch(&amp;#039;test.tpl&amp;#039;);&lt;br /&gt;
 }&lt;br /&gt;
 *plugins/insert.getTest.php(プラグイン使用時&lt;br /&gt;
 function smarty_insert_getTest($params, &amp;amp;$smarty) {&lt;br /&gt;
    $smarty-&amp;gt;assign(&amp;#039;title&amp;#039;, $params[&amp;#039;title&amp;#039;]);&lt;br /&gt;
    return $smarty-&amp;gt;fetch(&amp;#039;test.tpl&amp;#039;);&lt;br /&gt;
 }&lt;br /&gt;
==一時間以内のキャッシュクリア==&lt;br /&gt;
 $smarty-&amp;gt;clear_all_cache(3600);&lt;br /&gt;
&lt;br /&gt;
==自作のプラグインを置くDIRを用意==&lt;br /&gt;
以下のように定義することで自作プラグインDIRを個別に追加できる&lt;br /&gt;
 $smarty-&amp;gt;plugins_dir[] = &amp;#039;/var/www/smarty/plugins&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
==指定日以降にNEWを付ける==&lt;br /&gt;
 {{&amp;lt;nowiki /&amp;gt;if $smarty.now|date_format:&amp;#039;%Y-%m-%d %H:%M:%S&amp;#039;&amp;gt;=&amp;#039;2011-11-14 08:30:00&amp;#039;}}New!!{{&amp;lt;nowiki /&amp;gt;/if}}&lt;br /&gt;
 {{&amp;lt;nowiki /&amp;gt;if $smarty.now|date_format:&amp;#039;%Y-%m-%d&amp;#039;&amp;gt;=&amp;#039;2011-11-14&amp;#039;}}New!!{{&amp;lt;nowiki /&amp;gt;/if}}&lt;/div&gt;</summary>
		<author><name>127.0.0.1</name></author>
	</entry>
</feed>