I'm playing with the zend skeleton application and I would like to display a bootstrap alert after creating/updating an album in case of success (once return on the album list).
Here is the controller:
public function indexAction()
{
return new ViewModel(array(
'albums' => $this->getAlbumTable()->fetchAll(),
));
}
public function addAction()
{
$form = new AlbumForm();
$form->get('submit')->setValue('Add');
$request = $this->getRequest();
if ($request->isPost()) {
$album = new Album();
$form->setInputFilter($album->getInputFilter());
$form->setData($request->getPost());
if ($form->isValid()) {
$album->exchangeArray($form->getData());
$this->getAlbumTable()->saveAlbum($album);
// Redirect to list of albums
return $this->redirect()->toRoute('album');
}
}
return array('form' => $form);
}
According to you what is the best way to deal ?
Many thanks, Cedric.
使用flashMessenger插件将您的消息存储为数组,然后在视图中(最好还是视图助手)在数组中循环,并生成引导麦粒消息所需的标记。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.