Smarty

ZendFW + Smarty3の autoloader 併用

ZendFWとSmartyのautoloader が干渉して画面がエラーだらけになるのだが、 検索して、ようやく回避方々を発見。 Warning: include_once(Smarty\Internal\Data.php) Warning: include_once(Smarty\Internal\Template.php)http://karenziv.com/2010/09/zend-fr…

Zend_View_Smartyにコピーコンストラクタは必須。

Zend_View_Smarty (http://framework.zend.com/manual/ja/zend.view.scripts.html#zend.view.scripts.templates)一部のヘルパーでコピーコンストラクタの設定をしないと問題が発生する。 具体的にはPartial ヘルパー(と、それを内部的に呼び出しているクラ…

Zend + Smarty で Struts 調の例外ページ

Zendのエラー画面にこんなテーブルを表示させたい。 class Zend_Controller_Dispatcher_Exception code 0 message Invalid controller specified (hoge) file C:\Program Files\PHP\lib\Zend\library\Zend\Controller\Dispatcher\Standard.php(241) trace C:…

Smarty 美しいテーブルを作る。

正確には「Smarty の美しくもないテーブルを可能な限り見やすく作る」↓こんなテーブルを作る。 画像1画像2画像3 画像4余白余白 <table> {foreach from=$record|@array_chunk:2 item='result1' name='loop1'} <tr> {foreach from=$result1|@array_pad:2:false item='resu</tr></table>…

十全な Zend_View_Smarty

これで Zend_Layout も Zend_View_Helper も使えるはず。 レイアウトは {$layout->content} ヘルパーは {$helper->Form()} みたいに呼び出す。Zend_View_Abstract を継承して Smarty に必要な部分だけ上書き、という作り。 なのでヘルパーとかフィルターとか…

Smartyでテーブルの隙間を詰める

<tr> [テーブル作成用のループ] {assign var='cnt' value=$record|@count} {if $cnt%5>0} {section name='loop1' start=$cnt%5 loop=5} <td>&nbsp;</td> {/section} {/if} </tr> このくらいが見やすいか… プラグイン作るほどでもないし。 もう少し考えれば if 文を省略できそう…