protected function getTemplateId($template, $theme = null)
{
// no theme set = default theme
if ($theme === null) {
$theme = $this->getSetting('Core', 'theme');
}
// return best matching template id
return (int) $this->getDB()->getVar('SELECT id FROM themes_templates
WHERE theme = ?
ORDER BY path LIKE ? DESC, id ASC
LIMIT 1', array((string) $theme, '%' . (string) $template . '%'));
}