Index: trunk/core/kernel/utility/http_query.php =================================================================== diff -u -N -r3559 -r3571 --- trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 3559) +++ trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 3571) @@ -431,6 +431,7 @@ $template_found = false; if($url_part) { + // search for template in real template records array_unshift($url_parts, $url_part); $template_parts = $url_parts; $url_parts = Array(); @@ -446,6 +447,25 @@ } }while (!$template_found && $template_parts); + + // try to find template in virtual templates in case if such ability exists + if (constOn('CMS') && !$template_found) { + + $template_parts = $url_parts; + $url_parts = Array(); + do + { + $template_path = implode('/', $template_parts); + + $sql = 'SELECT PageId FROM '.TABLE_PREFIX.'Pages WHERE Path = '.$this->Conn->qstr($template_path); + $template_found = $this->Conn->GetOne($sql); + if(!$template_found) + { + array_unshift( $url_parts, array_pop($template_parts) ); + } + + }while (!$template_found && $template_parts); + } } // guess template if no existing template found @@ -467,8 +487,8 @@ } } - $this->Set('t', $this->getDefaultTemplate($template_found ? $template_path : '') ); + // pass params left to module $this->Application->Phrases->Init('phrases');