Index: trunk/core/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -N -r7635 -r8397 --- trunk/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 7635) +++ trunk/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 8397) @@ -2,6 +2,13 @@ class kModRewriteHelper extends kHelper { + /** + * Holds a refererence to httpquery + * + * @var kHttpQuery + */ + var $HTTPQuery = null; + function kModRewriteHelper() { parent::kHelper(); @@ -311,6 +318,7 @@ if ($template_found) { $vars['m_cat_id'] = $template_found['CategoryId']; $vars['t'] = implode('/', $url_parts); + $vars['is_virtual'] = true; // for template from POST return true; } } @@ -357,6 +365,15 @@ $vars = $this->parseRewriteURL($url,$passed); $cache = array('vars'=>$vars,'passed'=>$passed); $this->Conn->Query('REPLACE '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("mod_rw_'.md5($url).'", '.$this->Conn->qstr(serialize($cache)).', '.adodb_mktime().')'); + + if (isset($this->HTTPQuery->Post['t']) && $this->HTTPQuery->Post['t']) { + // template from POST overrides template from URL. + $vars['t'] = $this->HTTPQuery->Post['t']; + if (isset($vars['is_virtual']) && $vars['is_virtual']) { + $vars['m_cat_id'] = 0; // this is virtual template category (for Proj-CMS) + } + } + unset($vars['is_virtual']); } foreach ($vars as $name => $value) {