From e4fa30181ba835f18caec5076b89a158aa081719 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 5 Nov 2012 23:17:59 +0100 Subject: [PATCH] Added auto-guessing for template environment --- .../files/lib/page/AbstractPage.class.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wcfsetup/install/files/lib/page/AbstractPage.class.php b/wcfsetup/install/files/lib/page/AbstractPage.class.php index 3cdc4ee2d4..712c4ffece 100644 --- a/wcfsetup/install/files/lib/page/AbstractPage.class.php +++ b/wcfsetup/install/files/lib/page/AbstractPage.class.php @@ -162,28 +162,28 @@ abstract class AbstractPage implements IPage, ITrackablePage { // read data $this->readData(); + // assign variables + $this->assignVariables(); + + // call show event + EventHandler::getInstance()->fireAction($this, 'show'); + // try to guess template name + $classParts = explode('\\', get_class($this)); if (empty($this->templateName)) { - $classParts = explode('\\', get_class($this)); $className = preg_replace('~(Form|Page)$~', '', array_pop($classParts)); - + // check if this an *Edit page and use the add-template instead if (substr($className, -4) == 'Edit') { $className = substr($className, 0, -4) . 'Add'; } - + $this->templateName = lcfirst($className); } - // assign variables - $this->assignVariables(); - - // call show event - EventHandler::getInstance()->fireAction($this, 'show'); - if ($this->useTemplate) { // show template - WCF::getTPL()->display($this->templateName); + WCF::getTPL()->display($this->templateName, array_shift($classParts)); } } -- 2.20.1