public function getTemplate($p_templateIdOrName = null)
{
if (!is_null($this->m_template)) {
return $this->m_template->name;
}
if (!empty($p_templateIdOrName)) {
$tplObj = new MetaTemplate($p_templateIdOrName);
if (!$tplObj->defined()) {
$template = CampSystem::GetInvalidURLTemplate($this->publication->identifier, $this->issue->number, $this->language->number, !$this->m_preview);
$template = substr($template, strlen($this->getThemePath()));
} else {
$template = $tplObj->name;
}
} elseif (is_null($this->m_errorCode)) {
$template = CampSystem::GetTemplate($this->language->number, $this->publication->identifier, $this->issue->number, $this->section->number, $this->article->number);
if (is_null($template)) {
$template = CampSystem::GetInvalidURLTemplate($this->publication->identifier, $this->issue->number, $this->language->number, !$this->m_preview);
}
$template = substr($template, strlen($this->getThemePath()));
} else {
return null;
}
$filePath = CS_PATH_TEMPLATES . DIR_SEP . $this->getThemePath() . $template;
if (!file_exists($filePath)) {
return null;
}
return $template;
}