Index: trunk/kernel/include/category.php =================================================================== diff -u -r1566 -r1892 --- trunk/kernel/include/category.php (.../category.php) (revision 1566) +++ trunk/kernel/include/category.php (.../category.php) (revision 1892) @@ -959,7 +959,33 @@ // in this categories first parent category // and then using found moudle name as a key for module template paths array $path = $tpath[array_search ($ids[0], $roots)]; - $t = $path . $element->GetAttributeByName('_mod_template'); + + $module_templates = explode(',', $element->GetAttributeByName('_mod_template')); + $m_templates = Array(); + foreach($module_templates as $module_t) + { + $module_t = explode(':', $module_t); + if( isset($module_t[1]) ) + { + $m_templates[$module_t[0]] = $module_t[1]; + } + else + { + $m_templates['default'] = $module_t[0]; + } + } + $db =& GetADODBConnection(); + $sql = 'SELECT Name FROM '.GetTablePrefix().'Modules WHERE RootCat = '.$ids[0]; + $module = $db->GetOne($sql); + if( isset($m_templates[$module]) ) + { + $target_template = $m_templates[$module]; + } + else + { + $target_template = $m_templates['default']; + } + $t = $path . $target_template; } else $t = $element->GetAttributeByName('_template');