From: Alexander Ebert Date: Tue, 11 Oct 2011 17:08:17 +0000 (+0200) Subject: AbstractPage now tries to guess the template name X-Git-Tag: 2.0.0_Beta_1~1714 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2c8e27c9eaccdb6c1b90f1625cd739ecffec92c0;p=GitHub%2FWoltLab%2FWCF.git AbstractPage now tries to guess the template name --- diff --git a/wcfsetup/install/files/lib/page/AbstractPage.class.php b/wcfsetup/install/files/lib/page/AbstractPage.class.php index 045528da43..dbaf1341d7 100644 --- a/wcfsetup/install/files/lib/page/AbstractPage.class.php +++ b/wcfsetup/install/files/lib/page/AbstractPage.class.php @@ -21,6 +21,12 @@ abstract class AbstractPage implements IPage { */ public $templateName = ''; + /** + * enables template usage + * @var string + */ + public $useTemplate = true; + /** * value of the given action parameter * @var string @@ -131,8 +137,15 @@ abstract class AbstractPage implements IPage { // call show event EventHandler::getInstance()->fireAction($this, 'show'); - // show template - if (!empty($this->templateName)) { + if ($this->useTemplate) { + // try to guess template name + if (empty($this->templateName)) { + $classParts = explode('\\', get_class($this)); + $className = preg_replace('~(Form|Page)$~', '', array_pop($classParts)); + $this->templateName = lcfirst($className); + } + + // show template WCF::getTPL()->display($this->templateName); } }