本家版2.0.14では、テンプレートの扱いが大きく変わった、ということだけは知っていたのですが、wrapsが動かない、という症状を改善するためにあちこち追ってみて、どこなのかがようやくわかりました。
いわゆる肝は1箇所だけです。下のソースコードを読むのが一番手っ取り早いのですが、一応解説します。
- 利用テンプレートセットがdefault以外なら従来通りのDBテンプレート方式
- 利用テンプレートセットがdefaultの時だけ、FILEテンプレートに切り替わる
-- /themes/(テーマ)/modules/(dirname)/(テンプレートファイル) があれば、そのFILE (1)
-- なければ /modules/(dirname)/templates/(テンプレートファイル) からのFILEテンプレート (2)
-- それもなければ…空テンプレート (3)
俺的とX2の折衷案、という表現が正しいでしょうか。
ただ、この処理には参りました。というのも、D3モジュールでは、そもそも、そこにテンプレートファイルはありませんから、defaultテンプレートセットを利用されていると、テンプレートが読み込まれません。
というわけで、(3)の部分の改良をリクエストします。(コードでの赤字の部分)
-- それもなければ…DBテンプレートを読み込む (3)
これでバッチリです。お〜い、Skalpaさん、見てる?
class/smarty/xoops_plugins/resource.db.php
function smarty_resource_db_tplinfo( $tpl_name ) {
static $cache = array();
global $xoopsConfig;
if ( isset( $cache[$tpl_name] ) ) {
return $cache[$tpl_name];
}
$tplset = $xoopsConfig['template_set'];
$theme = isset( $xoopsConfig['theme_set'] ) ? $xoopsConfig['theme_set'] : 'default';
$tplfile_handler =& xoops_gethandler('tplfile');
// If we're not using the "default" template set, then get the templates from the DB
if ( $tplset != "default" ) {
$tplobj = $tplfile_handler->find( $tplset, null, null, null, $tpl_name, true);
if ( count( $tplobj ) ) {
return $cache[$tpl_name] = $tplobj[0];
}
}
// If we'using the default tplset, get the template from the filesystem
$tplobj = $tplfile_handler->find( "default", null, null, null, $tpl_name, true);
if ( !count( $tplobj ) ) {
return $cache[$tpl_name] = false;
}
$tplobj = $tplobj[0];
$module = $tplobj->getVar( 'tpl_module', 'n' );
$type = $tplobj->getVar( 'tpl_type', 'n' );
$blockpath = ( $type == 'block' ) ? 'blocks/' : '';
// First, check for an overloaded version within the theme folder
$filepath = XOOPS_THEME_PATH . "/$theme/modules/$module/$blockpath$tpl_name";
if ( !file_exists( $filepath ) ) {
// If no custom version exists, get the tpl from its default location
$filepath = XOOPS_ROOT_PATH . "/modules/$module/templates/$blockpath$tpl_name";
if ( !file_exists( $filepath ) ) {
return $cache[$tpl_name] = $tplobj ;
}
}
return $cache[$tpl_name] = $filepath;
}
im just the messenger.
Bandit-x wrotes:
but they are not . since the template files are supposed to be in the . templates directory.
GIJOE wrotes:
I say again, this is an incompatibility just with core 2.0.14/15/16 from xoops.org
Core team of xoops.org should fix it.
Just insert a few lines
I copied the file /trusted_path/modules/templates/index.html to a new folder /modules/testwrap/templates/testwrap_index.html and that seemed to do the trick.