From: Alexander Ebert Date: Mon, 5 Nov 2012 22:17:59 +0000 (+0100) Subject: Added auto-guessing for template environment X-Git-Tag: 2.0.0_Beta_1~808 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e4fa30181ba835f18caec5076b89a158aa081719;p=GitHub%2FWoltLab%2FWCF.git Added auto-guessing for template environment --- 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)); } }