Index: branches/RC/core/units/general/helpers/themes_helper.php =================================================================== diff -u -N -r11661 -r11682 --- branches/RC/core/units/general/helpers/themes_helper.php (.../themes_helper.php) (revision 11661) +++ branches/RC/core/units/general/helpers/themes_helper.php (.../themes_helper.php) (revision 11682) @@ -347,6 +347,25 @@ // use current theme, because it's available on Front-End return $this->Application->GetVar('m_theme'); } + + /** + * Returns page id based on given template + * + * @param string $template + * @return int + */ + function getPageByTemplate($template) + { + $sql = 'SELECT ' . $this->Application->getUnitOption('c', 'IDField') . ' + FROM ' . $this->Application->getUnitOption('c', 'TableName') . ' + WHERE + ( + (NamedParentPath = ' . $this->Conn->qstr('Content/' . $template) . ') OR + (IsSystem = 1 AND CachedTemplate = ' . $this->Conn->qstr($template) . ') + ) + AND (ThemeId = ' . $this->getCurrentThemeId() . ' OR ThemeId = 0)'; + return $this->Conn->GetOne($sql); + } }