Index: kernel/application.php =================================================================== --- kernel/application.php (revision 15532) +++ kernel/application.php (working copy) @@ -1740,6 +1740,19 @@ } /** + * Returns section template for given physical/virtual template + * + * @param string $template + * @param int $theme_id + * @return string + * @access public + */ + public function getSectionTemplate($template, $theme_id = null) + { + return $this->UrlManager->getSectionTemplate($template, $theme_id); + } + + /** * Returns variables with values that should be passed through with this link + variable list * * @param Array $params Index: kernel/managers/url_manager.php =================================================================== --- kernel/managers/url_manager.php (revision 15528) +++ kernel/managers/url_manager.php (working copy) @@ -85,12 +85,6 @@ */ public function HREF($t, $prefix = '', $params = Array (), $index_file = null) { - static $current_theme_id = NULL; - - if ( !isset($current_theme_id) ) { - $current_theme_id = $this->Application->GetVar('m_theme'); - } - if ( !$t ) { // when template not specified, use current $t = $this->Application->GetVar('t'); @@ -114,12 +108,9 @@ unset($params['use_section']); } - $theme_id = isset($params['m_theme']) ? $params['m_theme'] : $current_theme_id; - - if ( isset($use_section) && $use_section && array_key_exists($t . ':' . $theme_id, $this->structureTemplateMapping) ) { - // structure template corresponding to given physical template - $t = $this->structureTemplateMapping[$t . ':' . $theme_id]; - unset($params['use_section']); + if ( isset($use_section) && $use_section ) { + $theme_id = isset($params['m_theme']) ? $params['m_theme'] : null; + $t = $this->getSectionTemplate($t, $theme_id); } if ( preg_match('/external:(.*)/', $t, $regs) ) { @@ -402,6 +393,34 @@ } /** + * Returns section template for given physical/virtual template + * + * @param string $template + * @param int $theme_id + * @return string + * @access public + */ + public function getSectionTemplate($template, $theme_id = null) + { + static $current_theme_id = null; + + if ( !isset($current_theme_id) ) { + $current_theme_id = $this->Application->GetVar('m_theme'); + } + + if ( !isset($theme_id) ) { + $theme_id = $current_theme_id; + } + + if ( array_key_exists($template . ':' . $theme_id, $this->structureTemplateMapping) ) { + // structure template corresponding to given physical template + return $this->structureTemplateMapping[$template . ':' . $theme_id]; + } + + return $template; + } + + /** * Loads template mapping for Front-End * * @return void