/** * Method to render the view. * * @return string The rendered view. * * @since 1.0 * @throws \RuntimeException */ public function render() { switch ($this->getLayout()) { case 'news.view': case 'news.edit': // Get the input if (Factory::$application->input->get('task') != 'add') { $item = $this->model->getItem(); $this->renderer->set('item', $item); } break; case 'news.add': $this->setLayout('news.edit'); break; default: $items = $this->model->getItems(); $this->renderer->set('items', $items); if (count($items) >= 1) { Factory::$application->enqueueMessage("You've setup your database! Below are dynamic results.", 'success'); } else { Factory::$application->enqueueMessage('Here you see a sample page layout. Ideally this would pull articles from the database.', 'alert'); } break; } return parent::render(); }
/** * Method to render the view. * * @return string The rendered view. * * @since 1.0 * @throws \RuntimeException */ public function render() { if ($this->app->input->get('success', false)) { $this->app->enqueueMessage("Sweet! You've setup your database successfully. Check out the <a href=\"news\">Sample Page</a>", 'success'); } $this->renderer->set('success', $this->app->input->get('success', false)); $this->renderer->set('logo', DEFAULT_THEME . '/images/logo.png'); $this->renderer->set('config', $this->app->getContainer()->get('config')); return parent::render(); }