/** * Prepare the output and tell the template to render. */ public function output() { // Send globals to the template. $template = Template::getInstance(); if (!empty($this->page)) { $template->set('content', $this->page); } $template->set('google_analytics_id', Configuration::get('google_analytics_id')); // TODO: These should be called directly from the template. $template->set('errors', Messenger::getErrors()); $template->set('messages', Messenger::getMessages()); $template->set('site_name', Configuration::get('site.name')); $template->set('blog', Blog::getInstance()); JS::set('active_nav', $this->nav); $template->render($this->template); }
/** * Die on an error with a message in json format. * * @param string $error * The error message. * * @deprecated * The error() function will determine if json should be output based on the headers. */ public static function jsonError($error = '') { $data = array( 'errors' => Messenger::getErrors(), 'messages' => Messenger::getMessages(), 'status' => 'error', ); if (!empty($error)) { $data['errors'][] = $error; } // Output the data. header('Content-type: application/json'); echo json_encode($data); // Terminate the script. exit; }
/** * Output the data. */ public function output() { Output::json(array('data' => $this->data, 'messages' => Messenger::getMessages(), 'errors' => Messenger::getErrors())); }
<h1 id="page_header"><?php echo $page_header; ?> </h1> <? endif; $errors = Messenger::getErrors(); if (count($errors) > 0): ?> <div class="messenger error"> <ul><? foreach ($errors as $error): ?><li><?php echo $error; ?> </li><? endforeach; ?></ul> </div> <? endif; $messages = Messenger::getMessages(); if (count($messages) > 0): ?> <div class="messenger message"> <ul><? foreach ($messages as $message): ?><li><?php echo $message; ?> </li><? endforeach; ?></ul> </div> <? endif; if (!empty($content)) : $this->build($content); endif; ?> </div> <? endif; ?> </div>