register_prefilterの挙動を変えるとかなしにしようぜSmartyさん

Smartyにはプリフィルタ機能ってやつがあって、それぞれテンプレートのコンパイル前に下記の挙動を行うっていうのはよく知られた話。


register_prefilter()・・・プレフィルタを実行
register_postfilter()・・・ポストフィルタを実行
register_outputfilter()・・・アウトプットフィルタを実行

Smartyを使うPHPユーザーは、だいたいこれを使ってテンプレートを出力する際に共通ヘッダ、フッタなんかを出したりしてると思います。



で、最近Smarty3を使って例のごとくプレフィルタを実行しようとしたら、エラー

Notice: function call 'register_prefilter' is unknown or deprecated.

Smartyのバージョンなんてしばらく上げてなかったので、焦ってググると同じような症状に悩んでる人を見つけた。


ドキュメント読めよカスとでも言いたげなリンク一文が貼ってあるのでクリックすると。。。。


...orz

Name

registerFilter() — dynamically register filters
Description
void registerFilter(string type,
mixed callback);

Use this to dynamically register filters to operate on a templates. It uses the following parameters:

type defines the type of the filter. Valid values are "pre", "post", "output" and "variable".

callback defines the PHP callback. it can be either:

A string containing the function name

An array of the form array(&$object, $method) with &$object being a reference to an object and $method being a string containing the method-name

An array of the form array($class, $method) with $class being the class name and $method being a method of the class.

とりあえずregisterFilter()を使えよ、と。
変なクラス使うなよと。

ていうかこのクラス、いつから使えるようになってたの。。。
もしかして_prefilterを使うのがイレギュラーだったの。。。。

にしてもリンクくらい貼っておいてよSmartyさん!ヽ(`Д´)ノ ウワァァァン

次回に続く。