Re: EMLH smarty plugin and smarty default_modifiers
The one to call easiestml as an edit plug-in of the template was tested making it.
Reason to make this
'Management of content of article'
for the omission
ext.
en , ja , zh
if I writed
[en] [ja]
only lang tag articles
,
when lang tag is zh
too
display
[en] lang tag article
html/class/smarty/plugins/modifier.domi_easiestml.php
function smarty_modifier_domi_easiestml($str)
{
//option initialize
if (!isset($str)) {
return $str;
}
if (empty($str) || !is_string($str)) {
return $str;
}
global $easiestml_lang;
if (function_exists('easiestml') && isset($easiestml_lang) && defined( 'EASIESTML_LANGS' )) {
$original_easiestml_lang = $easiestml_lang ;
$easiestml_langs = explode( ',' , EASIESTML_LANGS ) ;
if ($easiestml_lang != $easiestml_langs[0] && !preg_match('/\['.preg_quote($easiestml_lang).'\]/i' , $str)) {
$easiestml_lang = $easiestml_langs[0] ;
}
$str = easiestml($str);
$easiestml_lang = $original_easiestml_lang ;
}
return $str;
}
html/class/template.php
Constructor
function XoopsTpl
about last lines add line
$this->default_modifiers = array('domi_easiestml');
html/class/template.php
// ob_start( 'easiestml' ) ;
なるほど。コンパイラフックですか!
どこでもXOOPSコメントと似ていながら違う方式で、かなり面白い手ですね。
確かにこれなら、デフォルト値の設定が可能ですね。
ただ、私の場合、どうしてもキャッシュを有効に効かせたい、という大前提があります。
私自身、サーバ管理者なので、「重い処理は勘弁して」というのが本音ですから
同じフック処理なら、各HTMLキャッシュの読み出し部分を乗っ取る、なんてのも手としてはアリかもしれませんね。それならキャッシュとしては効いていますし、全体のフィルターよりは副作用も少ないでしょう。
Afterwards, it understood from the present left as information.
Another side effect of method situation that uses
$this->default_modifiers = array('domi_easiestml');
specification of default_modifiers
Symptom:
The smarty debugging of Xoops was not displayed because of the error.
debug.tpl of smary.
It is (present smarty2.6.9) to the error an example using isset because of the description of the template.
{ if isset($_smarty_debug_output)
Quote:
Hereafter, it is specification quote Parse error:parse error and unexpected ('' expecting T_VARIABLE or'$'in/home/XXXXXX/xo/templates_c/%%XX^XXX^XXXXXXXXXXXX%%debug.tpl.php on line 10
I edited template to changed
{ if isset($_smarty_debug_output|smarty:nodefaults)