X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;ds=sidebyside;f=module%2FApplication%2Fsrc%2FApplication%2FView%2FListener.php;h=fc99fbaf2bcfbd0ec6ba250b6f983a8c636c6a66;hb=ef4bab29af1e4dd5aac3f87f1c3d8391808d514d;hp=275736dbfc809543ca8a445386746ab93bfa94ac;hpb=069c369af0d167f7bc1b359468f3136d50429747;p=zf2.biz%2Fgalerie.git diff --git a/module/Application/src/Application/View/Listener.php b/module/Application/src/Application/View/Listener.php index 275736d..fc99fba 100644 --- a/module/Application/src/Application/View/Listener.php +++ b/module/Application/src/Application/View/Listener.php @@ -40,8 +40,8 @@ class Listener implements ListenerAggregate public function attach(EventCollection $events) { $this->listeners[] = $events->attach('dispatch.error', array($this, 'renderError')); - $this->listeners[] = $events->attach('dispatch', array($this, 'render404'), -80); - $this->listeners[] = $events->attach('dispatch', array($this, 'renderLayout'), -1000); + $this->listeners[] = $events->attach('dispatch', array($this, 'render404'), -1000); + $this->listeners[] = $events->attach('dispatch', array($this, 'renderLayout'), -80); } public function detach(EventCollection $events) @@ -97,7 +97,7 @@ class Listener implements ListenerAggregate $response->setStatusCode(404); } - $script = 'pages/' . $page . '.phtml'; + $script = 'error/' . $page . '.phtml'; // Action content $content = $this->view->render($script); @@ -127,7 +127,7 @@ class Listener implements ListenerAggregate $content = $this->view->render($script, $vars); - $e->setResult($content); + $e->setParam('content', $content); return $content; } @@ -142,13 +142,15 @@ class Listener implements ListenerAggregate return $response; } - $footer = $e->getParam('footer', false); - $vars = array('footer' => $footer); + $vars = $e->getResult(); + if (is_scalar($vars)) { + $vars = array('content' => $vars); + } elseif (is_object($vars) && !$vars instanceof ArrayAccess) { + $vars = (array) $vars; + } if (false !== ($contentParam = $e->getParam('content', false))) { $vars['content'] = $contentParam; - } else { - $vars['content'] = $e->getResult(); } $layout = $this->view->render($this->layout, $vars); @@ -175,7 +177,7 @@ class Listener implements ListenerAggregate 'display_exceptions' => $this->displayExceptions(), ); - $content = $this->view->render('pages/404.phtml', $vars); + $content = $this->view->render('error/404.phtml', $vars); $e->setResult($content);