$this->template->content = View::factory('welcome/index_news') ->set('news', $news, false);
$this->template->set('content', View::forge(), false);
Call to a member function show_errors() on a non-object
public function action_add () { $val = Validation::factory('add_news'); $val->add('caption', 'Titel')->add_rule('required'); $val->add('body', 'Body')->add_rule('required'); if ($val->run()) { $news = new Model_News(array( 'caption' => $val->validated('caption'), 'message' => $val->validated('body'), 'archieved' => 0, 'time_posted' => Date::factory()->get_timestamp(), )); if ($news->save()) { Session::set_flash('success', 'Nieuws toegevoegd.'); Response::redirect('admin/news'); } else { Session::set_flash('error', 'Er is een fout opgetreden, gelieve opnieuw te proberen!'); Response::redirect('admin/news/add'); } } $this->template->title = 'Nieuws toevoegen'; $this->template->set('content', View::forge('admin/news_add'), false) //$this->template->content = View::factory('admin/news_add') ->set('val', Validation::instance('add_news'), false); }
<h2>Nieuws toevoegen</h2> <p>Voeg nieuws toe, door volgende gegevens in te vullen.</p> <div class="options"> <div class="option"><?php echo Html::anchor('admin', 'Admin'); ?></div> <div class="option"><?php echo Html::anchor('admin/category', 'Categorien'); ?></div> <div class="option"><?php echo Html::anchor('admin/products', 'Producten'); ?></div> <div class="option"><?php echo Html::anchor('admin/news', 'Nieuws berichten'); ?></div> </div> <?php echo $val->show_errors(); ?> <?php echo Form::open('admin/news/add'); ?> <div class="input text required"> <?php echo Form::label('Titel', 'caption'); ?> <?php echo Form::input('caption', e($val->input('caption')), array('size' => '30')); ?> </div> ..........
It looks like you're new here. If you want to get involved, click one of these buttons!